PHP的依賴管理工具-Composer

jieforest發表於2012-11-18
In this article I will introduce you to another great project, Composer. Maybe you’ve experienced the pain of working on a PHP application which uses third-party libraries and then trying to keep them and their dependencies up to date. If so, Composer can soothe your pain.

Composer gets you the libraries you want at the versions you need. And if those libraries use other libraries, it can install those and manage them as well. Dependency management can be a hassle-free experience using Composer.

Installing Composer

Composer is bundled as an executable Phar archive, so make sure you have the Phar extension enabled in your php.ini file (uncomment extension=phar.so).

I recommend download the latest snapshot of the Composer executable directly from the project’s website.

Alternatively, there is an installer script. that you can run. If you’re comfortable with the issues surrounding such installers, you can cut and paste the following taken from the Composer website:

CODE:

curl -s https://getcomposer.org/installer | phpTo make Composer globally accessible on your system, move the resulting composer.phar file to a suitable location, like so:

CODE:

sudo mv composer.phar /usr/local/bin/composer

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/301743/viewspace-749420/,如需轉載,請註明出處,否則將追究法律責任。

相關文章