Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

This question is in regard to F3 (Php Fat Free framework) onto which I have stumbled looking for a simple, fast and secure framework suitable for small websites and/or blogs. What was important to me was that the framework have some sort of ACL, and simplicity. If you know of any good alternatives, I'm all ears. In the meantime, a question about F3 for those who have had experience with it:

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

Many thanks

Edit: I would also like to hear some opinion on Yii, I see it ranked quite highly on PHPFrameworks.com

like image 242
Swader Avatar asked Nov 27 '25 20:11

Swader


1 Answers

F3 doesn't bloat itself with any built in MVC architecture, it's basically just a front-controller. And that's the whole point. Instead of forcing you to use a specific set of tools, you can implement whatever you want. For example, if you don't like F3's Axon and Template plugins, you can use Red Bean ORM to manage your models, and Smarty to build your views. F3, at it's core, just routes urls to your controllers and stays out of your way.

like image 96
nicholas Avatar answered Nov 30 '25 09:11

nicholas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!