Posts

Showing posts with the label orm

Creating my First PHP Framework : Day 2

Image
First things first , i'needed a file (init.php) witch requires all other components of the framework , also all the static variables such as APP and CSS directories so i called it init.php                                                       <?php define ( ' ROOT ' , dirname ( __DIR__ )); define ( ' APP ' , ROOT . "/ app /" ); define ( ' WEBROOT ' , " http:// " . $_SERVER [ ' HTTP_HOST ' ] . dirname ( $_SERVER [ ' PHP_SELF ' ]) . " / " ); define ( ' CSS ' , WEBROOT . " css/ " ); define ( ' IMG ' , WEBROOT . " img/ " ); define ( ' JS ' , WEBROOT . " js/ " ); define ( ' DS ' , ROOT . " / " ); require_once ROOT . ' /vendor/autoload.php ' ; require_once APP . ' /core/App.php ' ; require_once APP . ' /database.php ' ; Also i need to require 3 files autoload.php : composer's a...

Creating my First PHP Framework : Day 1

Image
Why ?  So why should you write your own framework? Firstly, it is a great learning experience. You will get to learn PHP inside-out. You will get to learn object-oriented programming, design patterns and considerations. More importantly, you have complete control over your framework. Your ideas can be built right into your framework. Although always not beneficial, you can write coding conventions/functions/modules the way you like. 11 Months ago i started building MVC Php framework ,   the idea was create a simple flixible framework   which any developer can use it without problem ORM The ORM  is a kind of abstraction of database , it avoids you to to write long SQL statmemnts using  functions eg save to INSERT data or to find   to SELECT data use Cake\ORM\TableRegistry ; $data = [ ' title ' => ' My first article ' , ' body ' => ' It is a great article ' , ' user_id ' => 1 , ...