21

I would like to start learning Codeigniter. But it seems that Codeigniter has not support for installation via Composer. When I search in Google I found this link. It seems that Codeigniter has not support for autoload.php file created by Composer. The documentation describes the only installation via downloading .zip archive. I am not sure if Codeigniter is a good choice now. Is it?

Anbuselvan Rocky
  • 606
  • 6
  • 22
Čamo
  • 3,863
  • 13
  • 62
  • 114

4 Answers4

31

It has composer support in version 3. According to the documentation you can set in application/config/config.php .

$config['composer_autoload'] = TRUE;  //around 134 line

It will search for composer autoload script inside application/vendor . Place composer.json inside application(Codeigniter's application folder, not the root) folder. Then run composer init, and then - composer install.

And if CI fits you, then its right tool for your job:)

p.s. there is also a composer installer here https://github.com/kenjis/codeigniter-composer-installer

cssBlaster21895
  • 3,670
  • 20
  • 33
  • 7
    Just to expand on this. If you want to install composer somewhere else you can set that config to the composer path instead of just TRUE – jfadich Sep 01 '15 at 20:25
  • I found it in config. But it seems it only support including autoload file created by Composer. Is there a way to install(create project) whole Codeigniter via Composer with all necessary settings? – Čamo Sep 01 '15 at 21:46
  • I just created an empty composer.json. is it mandatory to add at least one plugin inside json to run init because I am getting "./composer.json" does not contain valid json. – Harish Ninge Gowda Nov 07 '16 at 05:15
  • 1
    you don't have to add libraries, just start with composer init inside directory, it will guide you and produce valid composer.json file – cssBlaster21895 Nov 07 '16 at 08:12
13

use the following code

composer create-project kenjis/codeigniter-composer-installer codeigniter

Source

Yassine Sedrani
  • 619
  • 5
  • 12
9

According to the documentation you can configure the config.php file inside config folder,

change the $config['composer_autoload'] line to

$config['composer_autoload'] = TRUE; 

or use path

$config['composer_autoload'] = FCPATH . 'vendor/autoload.php'; 
2

Tips 1:

A Multi-Framework Composer Library Installer

http://composer.github.com/installers

Tips 2:

composer create-project kenjis/codeigniter-composer-installer codeigniter
Zoe
  • 27,060
  • 21
  • 118
  • 148
venkatskpi
  • 800
  • 6
  • 8