Solutions to the slow pace of composer domestic

Source: Internet
Author: User

Original address: http://muxucao.cn/news-132.html

Usage:

There are two ways to enable this mirroring service:

1 Add the following configuration information to the Composer configuration file Config.json (System global Configuration). See "Example 1"

2 Add the following configuration information to your project's Composer.json file (configured for a single project). See "Example 2"

In order to avoid the installation of the package two times to execute the query, remember to add the disabled packagist settings, as follows

12345 {    "repositories": [        {"type""composer""url""http://pkg.phpcomposer.com/repo/packagist/"},        {"packagist"false}    ]}

Example 1, modifying the composer configuration file

View Composer Home directory: the composer config-l-G command allows you to list the global configuration information for the composer, where the [home] configuration entry is the home directory of composer. Linux users please perform the sudo composer config-l-g command.

Enter the composer home directory, open the Config.json file (if you do not create one yourself), and then increase the configuration information for this image service, the final content is as follows:

1234567 {    "config": {    },    "repositories": [        {"type""composer""url""http://pkg.phpcomposer.com/repo/packagist/"},        {"packagist"false}    ]}

Example 2, with the Laravel project's Composer.json configuration file as an example, add this image service configuration information as follows (note the last few lines):

12345678910111213141516171819202122232425262728293031323334353637383940 {    "name""laravel/laravel",    "description""The Laravel Framework.",    "keywords": ["framework""laravel"],    "license""MIT",    "type""project",    "require": {        "laravel/framework""4.2.*"    },    "autoload": {        "classmap": [            "app/commands",            "app/controllers",            "app/models",            "app/database/migrations",            "app/database/seeds",            "app/tests/TestCase.php"        ]    },    "scripts": {        "post-install-cmd": [            "php artisan clear-compiled",            "php artisan optimize"        ],        "post-update-cmd": [            "php artisan clear-compiled",            "php artisan optimize"        ],        "post-create-project-cmd": [            "php artisan key:generate"        ]    },    "config": {        "preferred-install""dist"    },    "minimum-stability""stable",    "repositories": [        {"type""composer""url""http://pkg.phpcomposer.com/repo/packagist/"},        {"packagist"false}    ]}

Description

The use of this image service means that all downloaded installation package metadata will come from this mirror service and no longer request to packagist.org. This speeds up the Composer installation process and is more reliable and fast. (For well-known reasons, foreign sites are too slow to connect and can be wall-ready)

In general, the data of the installation package (zip file, etc.) is generally downloaded from GitHub or other third party servers, after using this image service, we will cache all the installation package to the domestic machine room, so that no longer to the foreign site to initiate the request, so even if packagist.org, Github.com or other third-party services fail (mainly the connection speed is too slow and the wall is), you can still download and update the installation package.

Composer China Mirror: http://pkg.phpcomposer.com/

Solutions to the slow pace of composer domestic

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.