Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Code Ingiter w/ Flourish (my setup)

posted by tur-nr 8 years ago

If you are looking to use the Flourish Library along with Code Igniter MVC I have simply created a nice package wrapper for Code Igniter 2.0. https://github.com/tur-nr/ci-f

The reason why I done this was because of the lack of ORM support in Code Igniter and Flourish's ORM is just beautiful to work with.

Just thought I'd share with anyone interested in integrating the two for their web applications. Let me know what you think or even if it works for you :)

fActiveRecord Models

To create a fActiveRecord model all you do is put your class into the models folder in the ci-f package and call the following from your controller:

// maps User class to the table Users in the default database
$this->flourish->model('User');

// maps Group class to the user_groups table in the default database
$this->flourish->model('Group', 'user_group');

// maps the Admin class to the administrators table in the database named admins_only
$this->flourish->model('Admin', 'administrators', 'admins_only');

fDatabase Helper

The package also comes with a helper to quickly create fDatabase instances from the database configurations set in Code Igniter.

// attaches a new fDatabase from CodeIgniter db config
fORMDatabase::attach( fDatabase(true) );

Thanks for taking the time to share this with others!

posted by wbond 8 years ago

Nice work, Thanks for sharing...

posted by emadgh 8 years ago