Composer package management using an intranet private warehouse

Source: Internet
Author: User
Because of the long-term use of composer for package dependency management, many common libraries are placed on GitHub, referencing dependencies between multiple projects, and updating versions with a lot of cost savings, but there are still some problems:

    • Each update, the local need to run through the unit you test, commit and push to GitHub, waiting for the composer update before it takes effect;
    • There is no way to put a company-level module on GitHub;

Official programme

Fortunately, Composer provides the form of a private warehouse:

{"Repositories": [{"Type": "vcs", "url": "http://svn.example.org/projectA/", "Trunk-path": "Trunk", "Branches-path": " Branches "," Tags-path ":" Tags "}]}

Specific reference: HTTPS://GETCOMPOSER.ORG/DOC/05-REPOSITORIES.MD

Since the company is using Subverison, using the same way as the import of the private warehouse, in fact, in the form of SVN checkout to the specified tags checked out, this time the vendor directory will appear. SVN directory, which causes the main project not to commit, even in the switch tags when there is no way to check out the situation.

Many people in the composer Project issue this issue, and the solution is to replace SVN checkout with SVN export, which requires the following plugins:

Https://github.com/LinearSoft/composer-svn-export

New Solutions

The plug-in is equal to the need to build a packaglist site, in fact, only need a Packages.json file, but need a valid HTTPS service, otherwise the following error will occur:

➜www.my-project.com composer Updateyou is running composer with xdebug enabled. This have a major impact on runtime performance. See https://getcomposer.org/xdebugAdded Svnexport repo:newpackageloading composer repositories with package                                                                                                                                               Information                                                                                                     [Composer\downloader\transportexception] The "Https://packagist.my-project.dev/packages.json" file could not being Downloaded:ssl operation failed with code 1.                                                            OpenSSL Error Messages:error:14090086:ssl routines:ssl3_get_server_certificate:certificate Verify failed                                                                                                                      Failed to enable Crypto Failed to open Stream:operation failed          

If there is no such HTTPS service, you can choose to build a Packages.json file on gist to achieve the effect:

{"Packages": {"Tc/analyse": {"0.9.2": {"name": "Tc/analyse", "Version": "0.9.2", "source": {"type": "SVN", "url": "HT Tps://svn.tc.dev/library/analyse "," Reference ":"/tags/0.9.2 "}," 0.9.3 ": {" name ":" Tc/analyse "," Version ":" 0.9.3 "," SOURCE ": {" type ":" SVN "," url ":" Https://svn.tc.dev/library/analyse "," Reference ":"/tags/0.9.3 "}}," Dev-master ": {" NA Me ":" Tc/analyse "," Version ":" Dev-master "," source ": {" type ":" SVN "," url ":" Https://svn.tc.dev/library/analyse "," Reference ":"/trunk "}}}}}

The gist address is populated on Composer.json in the main project

{"Require": {"PHP": ">=5.4.0", "Tc/analyse": "0.9.3", "Linearsoft/composer-svn-export": "^0.1.2"}, "Extra": {" Svn-export-repositories ": [{" Name ":" TC "," type ":" Composer "," url ":" Https://gist.githubusercontent.com/lancerhe/37 9eeee89fd0db8c0c4ca19c6bddas2f/raw/915a720635949c9d4013746845b952f88af358db "}]}," minimum-stability ":" Stable "}

Run Composer update

➜  www.my-project.com composer Updateyou is running composer with xdebug enabled. This have a major impact on runtime performance. See https://getcomposer.org/xdebugAdded Svnexport repo:tcloading composer repositories with package informationupdating dependencies (including Require-dev)  -Updating tapcash/analyse (0.9.2 = 0.9.3)    exporting/tags/0.9.3writing Lock filegenerating autoload files
  • 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.