ray-ang / basicphp

BasicPHP - A frameworkless class library for developing web applications and services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MVC-less version?

aolko opened this issue · comments

commented

Can you provide an MVC-less branch for people who prefer MV* model or none at all?

Hi @aolko . The current release uses MVC approach, but it is not MVC-dependent. The major files are index.php, config.php, functions.php and routes.php. The models and controllers folders were just autoloaded to adhere to MVC, with the views folder containing included html scripts in php files. Do you mean a branch without controller files, and just include php files based on the path with an autoloaded models folder?

commented

Do you mean a branch without controller files, and just include php files based on the path with an autoloaded models folder?

basically that, lighter if possible

I have explored that option before and realized that for better code organization a class-based approach is better then file-based. The framework has the same auto routing capability as Codeigniter (i.e. /class/method in the url) using just 1 controller class rather than separate the methods under 1 class into individual php scripts.

commented

Can you redo the router to match sinatra style? Or similar to a cross of macaw and klein.php.

As for classes, at least redo them as statics.

Macaw and klein rely on composer. BasicPHP is a very simple framework that does not need composer. It does, however, in addition to automatic routing, have the route_class( ) function for endpoint routing to create REST API's, just like any other PHP framework.

The route_class( ) function was designed to instantiate an object, that is why the controller classes are not static.

commented

I don't see any heavy reliance here, the point is the sinatra-like syntax, not composer.

I mean to use Macaw or klein, you need composer. The endpoint routing syntax may be same as other PHP frameworks as well.

commented

I mean to use Macaw or klein, you need composer

True, but still not the point

The endpoint routing syntax may be same as other PHP frameworks as well.

Nah, sinatra-like is better and way more readable

Can you make a pull request, so I would be able to check your code and possibly integrate?

commented

that will basically mean writing that thing from scratch, so, in case if you want to see taped macaw to it, maybe?

I guess I will have to leave the routing as is for now. It's just 1 function for the endpoint routing with the syntax like the other frameworks.