Magic function library for Codeigniter like CakePHP

Magic functions list for CI
CodeIgniter is a powerful PHP framework with a very small footprint, and very useful for website.
Today I am going to introduce you the Magic function for CI like CakePHP.
What is Magic Functions
As the name “Magic function” there are some magic with its library which you can download from here .
By using this library, you don’t need to do define any function in your models all functions which you want it has already created just like magic. There is a library Magic.php
which convert your function into Database Query and produce result as you want.
Clone the Magic.php
in your local directory and place it into application/library
in your CI project. Now set this library in application/config/autoload.php
. so don’t need to load in every controller.
$autoload['library'] = array('Magic');
Now your magic library is ready to use with $this->magic
instance.
Structure:
$this->magic
Instance of library. ->tableName
set table name for fetch data from DB. ->findAll($conditions=array())
Get all data from table.
Now the magic begin.
$this->magic->tableName->findByTableColoumName($param);
Example
$this->magic->tableName->findById(2);
$this->magic->tableName->findByName('user');
$this->magic->tableName->findByUserName('user');
$this->magic->tableName->findByEmail('user@email.com');
Find All Results
$this->magic->tableName->findAll($conditions = array());
Count All Records
$this->magic->tableName->findCount($conditions = array());
Git repository : Download source code