Writing a small custom PHP framework

By | August 2, 2015

There already exists several open source PHP frameworks, but they can often be a bit comprehensive to learn. Instead I have started writing a small framework in PHP myself. I is build on basic principles like OO (Object oriented) code for encapsulation,
MVC (Model View Controller) for reusablity and structured code, ORM (Object-Relational Mapping) for easy model creation and mapping to database fields,
CRUD  (Create Read Update Delete) for a uniform way to manipulate data.
It is build in PHP as this is a very popular serverside language and it utilizes a MYSQL database via PDO (PHP Data Object) prepared statements with parameterized queries for security and easy mantainability. The framework uses URL Rewrite module (.htaccess) for routing the page via clean urls and also has access rights for better security.

The configuration for the path and sql passwords are done in:
public/index.php
public/.htaccess
private/app/core/loader.php

All controller classes must be named with “Controller” postfix to avoid class name coincidence. The framework currently supports parameters sent as GET or POST variables. Routing to certain controllers can be done visting URL http://website/controller/method/param1/param2/param3/… Also there is functionality for partial views, so multiple controllers and views can be gathered into a single page.

Download source