Creating my First PHP Framework : Day 2

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

                   
               
                 
Project directory structure


<?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 autoloader for project dependicies .
App.php : to simplify things this file loads the controller corresponding to the pages
database.php : simply database configuration for the framework using Cakephp ORM




the framework on girhub

Comments

Post a Comment

Popular posts from this blog

Twitter API with PHP

Realtime Chat Application with CakePHP and Socket.IO #1

Let's build a mobile application with Ionic Framework #3