overview

This project is an object-oriented MVC PHP framework that can be used to build RESTful APIs and web applications. It is designed to be very lightweight and easy to use. The main reason I created it was because I wanted to use PHP to create a web app but I did not want to use a bloated framework like Laravel. Secondly, I wanted to refresh my knowledge of PHP and learn how to create a framework. However, after creating it, I never ended up using it because I don't have the love for PHP that I used to when it was the only web language I knew.

features

Detailed documentation is available on the GitHub repository. I will list some of the features here:

Middlewares are classes that can be used to modify the request and response objects before the controller is called.

Controllers are classes that are used to handle HTTP requests and echo a response.

Models are classes that are used to interact with the database. They can hook into a global database object that is essentially a PDO wrapper. Models were more loosely implemented than controllers and middlewares as they were not required to be used.

View in this framework is a single directory containing static files to be served as a single page application generated by a frontend framework. This part is also optional.

routing

Routing is done by a Router class that could match URI Regex patterns and request methods to controllers. Middlewares and controllers are registered to the router and the router calls the middleware before the controller. An interesting optimization I made was to seperate static routes from dynamic routes. That is, routes registered with a static URI could be mapped in O(1) time while dynamic routes would be mapped in O(n) time.

testing

The framework includes comprehensive unit and integration tests including all the features of the framework. The tests were written using PHPUnit and are run in a GitHub Actions workflow.

final_note

I honestly think PHP is an underrated language and should be learned before diving into Node.js. It gave me such a foundational understanding of HTTP and web development that is abstracted away in Node.js with its vast ecosystem of libraries.

I would recommend this framework to anyone who is looking to learn how to create a web framework or wants to create a simple web app in PHP. I cannot vet how production ready it is because I never used it in production... but it should be fine.