• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI 3 & composer

So heres something really cool about CI3. You get all the core features of which there are many... and you can always add more, just like any other framework CI 3 supports composer packages. Here's a quick summary:

CI3 allows you to autoload composer packages via your config file.

Edit your config.php file and set the following:

PHP Code:
$config['composer_autoload'] = TRUE

Next, and since CI3 looks for the vendor folder in application/vendor we need to tell composer where to store our composer packages.

So open your composer.json file and add the following line to the top of the file.

"config": {
"vendor-dir": "application/vendor"

Now lets assume you want to use the symfony dump() command to debug your code. Simply run this from the command line.

composer require symfony/var-dumper

Let composer do its thing... and once done you're ready to roll.

PHP Code:
$users $this->users->get_all();
dump($users); //symfony dump library 

Voila, you're done. Fraekin powerful and now you can use all the packages available from http://www.packagist.org


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.