I want to increase the functionality of my CodeIgniter project by integrating some code that is written in laravel? how do I approach, Can I include the code via library in CodeIgniter ? If yes How? I only want to include controllers and ORM into the CI.
Laravel code is a kind of api fetcher with function talks with other 3rd party services.
Yes you can use composer to install Laravel specific modules/projects, third-party projects in your CodeIginter. Just include
autoload
in your `index.php' file at topI am using
Eloquent
as ORM in my CodeIgniter codebase.Create a classmap to your app directory in
composer.json
Use Eloquent
To use
Eloquent
, you will require to create a library to setup Eloquent for use.Now load the auto load the library, and you have the eloquent beauty.
Similarly, you can use
MonoLog
for logging,Whoops
for error display,Formers\Former
for form building etc.Use Whoops
You can place this code somewhere after
autload
and defining CI Environment in yourindex.php
to use beautiful https://github.com/filp/whoops libraryYou can also extend
CI_Router
to use Laravel style routing in your Code Igniter app.Blade Templating
You can extend the
CI_Loader
to useBlade
templating in Code Igniter. Create a new fileMY_Loader
in yourapplication/core
directory with this code.You may have to create a config file
blade.php
in yourapplication/config
directory to storeblade
specific configurations.Now you can do something like this in your controller