Discover Cygnite Framework To Make Your Job Simple And Better.

A Modern PHP Framework For Web Developers.
Latest Stable Version Total Downloads



Quick Start

  • Install and Configuration
  • Creating Controller
  • Creating Model
  • Creating View
  • Routing
  • Display Data in View

Install and Configuration

No complicated xml/yaml configuration files. Simply install latest software via composer,configure your database connection in apps/configs/database.phpand you are ready to start your awesome application.

Install via Composer

Cygnite Framework is powered by Composer for managing it's dependencies. The best and recommanded way to install Cygnite Framework is to download composer.phar to your local directory or to use globally on your system, move it to usr/local/bin. For windows users please download composer and install composer setup.

You may install Cygnite Framework either simply downloading skeleton application from github repository or install via composer. Composer installation is more convenient and recommended.

Now open terminal (Command prompt window for windows) and go to your root directory, where you want to install Cygnite Framework.

Composer Create Project

composer create-project cygnite/cygnite-application cygnite --prefer-dist
composer.phar create-project cygnite/cygnite-application cygnite --prefer-dist

The above command will create a skeleton project into the directory. That's all you are ready to build your awesome application.

Manual Download

If you are experiencing trouble with composer installation you can also simply download the latest framework from below github repository. Download Cygnite Framework

Server Requirements

The Cygnite Framework has a very few system requirements:

# PHP >= 5.3x

# MCrypt PHP extension

# PDO extension must be enabled

# PHP CLI must be enabled for Cygnite CLI to work

Creating Controller

To get started, there are sample controller available into the apps/controllers directory. You can also create controller.

namespace Apps\Controllers;

use Cygnite\Foundation\Application;
use Cygnite\Mvc\Controller\AbstractBaseController as BaseController;

class UsersController extends BaseController
   public function __construct()

   public function indexAction()
      echo 'Hello World!!';

Creating Model

Cygnite Skeleton application also shipped with sample model into your apps/models/ directory. You can create your model in same directory to interact with your database. Your model class name should be StudlyCaps, every model class act as simple orm to map your database tables as objects, Cygnite Model follows ActiveRecord style highly inspired by ruby on rails. Your table name must be lowercase followed by underscore prefix.

Example- If your table name is guest_book than your model name should be GuestBook.

namespace Apps\Models;

use Cygnite\Database\Schema;
use Cygnite\Foundation\Application;
use Cygnite\Common\UrlManager\Url;
use Cygnite\Database\ActiveRecord;

class GuestBook extends ActiveRecord
    * Your database name goes here
    * @param database 
    protected $database = 'cygnite';

    * @param $tableName
    * Optional. If you don't provide table name here class will act as database table.
    //protected $tableName = 'guest_book'; 

    * Primary key of your table
    * We recommend to have id as primary key
    protected $primaryKey = 'id';

    public function __construct()

Creating View

Next, let's create simple view to display our welcome page which is reside in apps/views directory. Cygnite gives you flexibility to use either plain php layout or twig template engine. You are allowed to use widget to render partial views. Example-

        <h1>Welcome to Cygnite Framework QuickStart </h1>
            Congrats !! You have created your first view page.

You can also create template layout and render the sections into it. Cygnite Framework has built in support for most elegant and powerful twig template engine. For more details check Views


Cygnite Framework has powerful routing features. You can use routerconfig.php inside your apps directory. Also you can write powerful rest api with simple closure object with routes.php. Cygnite Framework also gives you flexibility to call controller with parameters from your router directly.

Let us create our first routing.

Example -

1. For direct routing use routerconfig.php .

    return array(
       '/profile/(\w+)/'             => 'user.profile',

2. router.php has closure support to build powerful REST api.


    // Before Router Middleware
    $router->before('GET', '/.*', function() {
          echo "Cygnite Framework has awesome features ";

For brief details please have a look into routing guide.

Display Data Into View

Let us see how to display data into view. If you are using plain php view page you should pass second parameter as to render function and if in the case of twig template engine you should be passing data into view using with().

     // using php layout and view
     $this->render('welcome', array('name'=> 'Cygnite PHP Framework'));

     // If you use twig template engine
                                    'messege' => 'Welcome to Cygnite Framework',

You need to assign values to view as by simply passing values to with function. You can get the data into the view (if plain php file used as view) or in layout as follows.

  echo $this->author;
  echo $this->email;

Generating Crud

Cygnite CLI now makes your job much more simpler. You can create simple crud operation via terminal. For more details have a look at Cygnite CLI - Crud Generator

Follow Us On Facebook Twitter Google+ Linkedin
Released Under The MIT Public License. Copyrights @2013-2014. Powered by- Sanjoy Dey Productions.