This project is read-only.

Documentation for Fork PHP


This document provides the overview of Fork PHP Framework.As before trying a new dish, Its important to read its racipe, similarly you have to go through this document before start your development with Fork PHP. We have tried our best to make this document concise.

Fork PHP is a MVC / Core PHP Framework with Updated programming techniques, Strong Library for developing web applications and services using PHP 5.3+.It is purely object oriented. We have tried our best to make development task as easier as possible.

What is a MVC Framework ??

Model–view–controller (MVC) is a software pattern for implementing user interfaces. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.
Modal : The central component, the model, consists of application data, business rules, logic, and functions.
View : A view can be any output representation of information, such as a chart or a diagram. Multiple views of the same information are possible, such as a bar chart for management and a tabular view for accountants.
Controller : The third part, the controller, accepts input and converts it to commands for the model or view.

Using this development pattern allows for very easy maintenance, as well as independent development of pieces of the same system by different programmers, which makes for quick turnover of applications all while still maintaining a very high standard of quality for the application.

Project Structure

Fork PHP project structure is dependent to itself. It means we have defined some protocols for structuring the files and folders. This structure is defined with concern to provide support to developers.

  • App
    • Application.ini
    • Exceptions.ini
  • Lib
    • Entities
      • Fork_admin.php
    • Config.php
    • Controls.php
    • EntityFramework.php
    • Framework.php
  • Modules
    • Admin
      • Controllers
        • loginController.php
        • indexController.php
        • homeController.php
      • Views
        • home
          • index.phtml
        • index
          • index.phtml
        • login
          • index.phtml
  • Layouts
    • Controllers
      • adminlayoutController.php
    • admin.phtml
  • Site
    • css
    • js
    • img


1) App

This folder contains the configuration files for the project.

a) Application.ini : Basic Configuration for the project
        application = tomwased_new      // Name of the application
        phpSettings.display_startup_errors = 1  // define the errors show/hide
        phpSettings.display_errors = 1    // define the errors show/hide
        mysql.maindb.adapter = PDO_MYSQL 
        mysql.maindb.username = root
        mysql.maindb.dbname = tomwased = localhost
        mysql.maindb.password = 

        mysql.forkAdmin.adapter = PDO_MYSQL
        mysql.forkAdmin.username = root
        mysql.forkAdmin.dbname = forkAdmin = localhost
        mysql.forkAdmin.password = 
b) Exceptions.ini : Exceptions defined for the project
        exception_1000="Exception %u : Undefined Module %s"
        exception_1001="Exception %u : Controller Class not found"
        exception_1002="Exception %u : Undefined Controller %s"
        exception_1003="Exception %u : Undefined Action %s in %s Controller"
        exception_1004="Exception %u : view file %s.phtml not found."
        exception_1005="Exception %u : layout file %s.phtml not found."
        exception_1006="Exception %u : Invalid call to view method from layout.viewRequired property is set to false from Action Object."
        exception_1007="Exception %u : Parameters passed to view in ajax call of %s Action"


We will explain you in next section, how you can define custom Exceptions.

2) Lib

This folder contains the various libraries included in fork PHP package. Initially we have added PHP Controls and Entity Framework Library.

a) Entity

This folder contains the Entity Classes files generated by Entity Generator. A Simple Entity file may look like


        class users extends EntityFramework
            private $id;
            private $username;
            private $password;
            private $token;
            function __construct()
                $class = __CLASS__;

          public function __get($property) {
            if (property_exists($this, $property)) {
              return $this->$property;

          public function __set($property, $value) {
            if (property_exists($this, $property)) {
              $this->$property = $value;

            return $this;

3) Modules

This is the main development folder. It contains all the Modules and their all corresponding files. In Fork PHP, We have defined modals as centralized Entities. It means there are multiple modules accessing DB through same Modals. Also with the Entity Framework, We have tried our best to provide the data as an Object.


A Module folder contains two child folders:

a) Controllers
b) Views

The controller and modal files are of *.php extension, whereas views are *.phtml extension.
(To learn how to define modals, views and controllers, look in next section.)

  • The controller files have naming convention like [CONTROLLER_NAME].php file:
    Example: Controller file’s names would be like indexController & adminController where name of controllers are index & admin respectively.
  • The views folder contains subfolders with the name of Corresponding Controller, and each acti has been defined as a view file with name like [ACTION_NAME].phtml file.
  • The modal Classes are situated in modals folder with name like [MOADL_NAME].php

4) Site

This folder contains the all static files for the project including css, javascript and img files. There are subfolders named as

  • css
  • js
  • img

The style sheets and javascript files are placed in these static folders respectively. Also the developers can place their subfolders to create hierarchy in project.

API Reference: Fork PHP 1.0



Last edited Apr 7, 2014 at 11:21 AM by eshantsahu, version 2