The examples in this article describe the operational steps and methods for the CI framework's dependent packages that are installed using composer. Share to everyone for your reference, specific as follows:
This article for Linux Systems, Windows first step according to the composer official website to install the following steps are the same
Step 1 Global installation composer
$ CURL-SS Https://getcomposer.org/installer | PHP
$ mv Composer.phar/usr/local/bin/composer
Step 2 Create Composer.json to your project root directory
{
"require": {"
Kriswallsmith/buzz": "*"
}
}
A Buzz package is added here to handle the HTTP request/response PHP 5.3.x class.
Step 3 execute the following command to download the dependency pack
Then you'll notice that composer has created a./vendors in your application directory and the code is inside.
Step 4 to add automatic loading of packages to a project
Plus the following line in your index.php.
Require_once './vendor/autoload.php ';
Need to load in
Require_once basepath. ' core/codeigniter.php ';
Front
Step 5 Test
Examples are as follows:
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;
}
}
See more available packages to view Packagist
More interested in CodeIgniter related content readers can view the site topics: "CodeIgniter Introductory Course", "CI (CodeIgniter) Framework Advanced Course", "PHP Excellent Development Framework Summary", "thinkphp Introductory Course", " Thinkphp Common Methods Summary, "Zend Framework Introduction Course", "PHP object-oriented Programming Introduction Course", "Php+mysql Database operation Introduction Tutorial" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design based on CodeIgniter framework.