Cygnite - A Modern Toolkit For Web Developers

The Elegant Way of Building Full-Featured Web Applications

Cygnite Dynamic Routing

Crud Generator- By Craft Console


Scaffolding - Code Generator


Generating crud may be painful using other framework, though there may be sample but still you need to write bunch of code to perform crud operations. Craft console makes it amusing. Cygnite CLI built on proven Symfony console component. Single command will generate necessary code for crud application with form validation, pagination etc. You may alter the code to make it fit to your application.

Setting Up Database Connection

Before running command make sure you have configured database connection into the src/Apps/Configs/database.php. You may have a look at Database Configuration if you are not before.

Changing To Application Directory

Open a terminal/command line window, and execute below command to change directory, then run generate command to generate your sample crud application.

cd /var/www/cygnite/console/bin

Running Generate Command

php craft generate:crud your_controller_name your_table_name your_database_name

If you want to run command against your default database connection then you can simply remove database_name from the above command as below.

  php craft generate:crud your_controller_name your_table_name

You can remove database name from the command as above, by doing that cygnite will identify default database connection from your configuration file src/Apps/Configs/database.php to generate crud. Above single line of command make you available sample crud operation against your table, pagination, validation, plain php layout with views etc.

Generating Crud for Twig Template

Cygnite Framework also allow you to generate twig template and views, which require you to add a additional parameter in the command.

 php craft generate:crud your_controller_name your_table_name your_database_name --template

Sample Application

Let us create a sample application using generate command. We will generate CRUD for -

  • i. Controller - user
  • i. Model (Table) - user
  • i. Database - social_network

 php craft generate:crud user user social_network

Controller, Model, Views, Form, Fields Validation, Pagination etc. all these cool features requires you to enter a simple generate command.

[Note: Remember your controller name and table name should be underscore prefix.]

Running The Application From Browser

Let's us enjoy our application simply browsing URL.


[Note: You don't have to include index.php in url, because Cygnite skeleton application already shipped with .htaccess.]

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