The CI framework uses composer for dependency package installation steps and methods analysis, cicomposer
This document describes how to use the composer to install dependency packages in the CI framework. We will share this with you for your reference. The details are as follows:
For Linux systems, the first step for windows is to install it on the composer official website. The subsequent steps are the same.
Step 1Global installation of composer
$ curl -sS https://getcomposer.org/installer | php$ mv composer.phar /usr/local/bin/composer
Step 2Create composer. json to the root directory of your project.
{ "require": { "kriswallsmith/buzz": "*" }}
A Buzz package will be added to process the HTTP Request/Response PHP 5.3.x class.
Step 3Run the following command to download the dependency package:
$ composer install
Then you will notice that composer has created a./vendors in your application directory and the code is also in it.
Step 4Automatically add packages to a project
Add the following line in your index. php
require_once './vendor/autoload.php';
To load
require_once BASEPATH.'core/CodeIgniter.php';
Front
Step 5Test
Example:
class Test extends CI_Controller{ public function index() { $browser = new Buzz\Browser(); $response = $browser->get('http://www.baidu.com'); echo $browser->getLastRequest()."\n"; echo $response; }}
For more available packages, see Packagist