Welcome Guest, Not a member yet? Register   Sign In
CI 3 & composer

(This post was last modified: 02-24-2016, 11:30 AM by BrendanRehman.)

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


Messages In This Thread
CI 3 & composer - by BrendanRehman - 02-24-2016, 11:26 AM

Theme © iAndrew 2016 - Forum software by © MyBB