F3 (Fat-Free PHP framework) and adding MVC / OOP structure to it

This question is about the F3 (Php Fat Free framework) that I stumbled upon, looking for a simple, fast and secure structure suitable for small sites and / or blogs. It was important for me that the structure had a kind of ACL and simplicity. If you know some good alternatives, I’m all ears. Meanwhile, the question of F3 for those who have had experience with it:

Is it possible to have a decent MVC OOP framework with F3? Since such routes F3::route('GET /',':indexController|home');do not work, how to implement a realistic MVC structure? I know that I can set the home method to static and then do it F3::route('GET /','indexController::home');, but this seems like unnecessary complication and redundancy, and ignores the build method that I need to set for each controller separately. What I would like to have in my index.php file are only routes to various controllers and actions, the rest of the logic will be processed in these controllers. What is the best way to approach this?

Many thanks

Edit: I would also like to hear an opinion about Yii, I see that it is very highly rated on PHPFrameworks.com

+3
source share
5

f3::route('GET /',array(new IndexController,'home'));

home(). f3 "" MVC. "" MVC.

+3

F3 MVC, -. . , , , . , F3 Axon Template, Red Bean ORM , Smarty - . F3, , URL- .

+6

MVC, F3. CodeIgniter Kohana ( PHP 5). MVC.

0

A trip to the Bakery doesn't seem to hurt. CakePHP has an excellent ACL core and can be as lightweight as you want it to be IMHO.

0
source

You can also transfer the route definition to a separate configuration file using this sample structure (routes.ini):

[routes]
GET|POST / = IndexController->indexAction
GET|POST @Index: /@lang = IndexController->langAction

and include it in the F3 configuration:

\F3::config('routes.ini');

Then add the directory with the controllers and models to AUTOLOADER. You can use as a view - for example, PHPTal . You are now almost ready for MVC over F3.

0
source

Source: https://habr.com/ru/post/1785797/


All Articles