DEV Community

Cover image for minimal-mvc: Frugal PHP micro-framework with basic routing and templating
Prahlad Yeri
Prahlad Yeri

Posted on

minimal-mvc: Frugal PHP micro-framework with basic routing and templating

Folks,

We already know about mind-blowing PHP frameworks like Laravel, Symfony, CodeIgniter, etc. and their enormous capabilities in making web development easier. But what about an even smaller micro-framework for PHP? Something along the lines of Flask or Bottle? Something you can use to develop things like REST API, prototyping something at initial stage or a frontend SPA app with just basic backend features?

Today, I want to introduce you to minimal-mvc, an extremely tiny micro framework with just two core scripts viz. routing.php for handling the routing and util.php for working with templates containing few other generic utilities.

Over my years of app development experience, I've found that these two capabilities are the critical minimum required features even in most basic or simple web apps. Adding CRUD and databases is a late stage capability which core PHP is more than capable of handling. But with a solid routing structure and a template system where you can quickly prototype multiple partial content pages based on a parent or base template is often very useful when starting a new app project.

I hope you will explore the minimal-mvc framework and I'll be even more glad if you find it useful for your projects.

Happy Programming!

Top comments (3)

Collapse
 
necrogami profile image
Anton C. Swartz IV

You should look into doing a bit of refactoring based on locations of code. Someone could currently call the util or router from the core folder via http request. It's best to move the logic outside the publically accessible folders. Think about maybe creating a public folder and moving the index into that. Also you aren't using composer in this that is basically a default for current development. Any reason why?

Collapse
 
prahladyeri profile image
Prahlad Yeri

@necrogami Thanks for the insights! This is just the alpha stage, it will take some time for this to become somewhat usable. For direct code access of util.php, etc., can we have a .htaccess rule or something which can take care of that? The app is usually more coherent and readable when all its contents are at one place in a single hierarchy.

Adding composer support is very easy. All you have to do is add a vendor directory along with core and run the composer require foo command. I've left this for the user to implement as the framework doesn't use any composer library (for now).

Collapse
 
necrogami profile image
Anton C. Swartz IV

Also if you haven't already seen it. Check out the slim framework: Slim Framework