CI Framework analysis of _php instances using composer installation-dependent steps and methods

Source: Internet
Author: User
Tags http request codeigniter composer install zend framework

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

$ composer Install

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.