The impact of composer on the PHP world is enormous, and the use of composer to replace Pear must be a trend. When the small partners are still immersed in the composer brought convenience, have you ever thought how to better use composer, online most of the direct download composer and then directly in the current directory to run the method is not a little sense of the cock wire it. Yes, it's a good tool to put in/usr/bin, but I prefer another way.
The first is the usual download Composer.phar to whatever directory. Like, like, home.
$ curl -sS https://getcomposer.org/installer | php
(This is the *nix installation method, please click here for the Windows platform)
Composer has a global command that can be used to install some common PHP commands such as composer, phpunit, etc. into the ~/.composer/vendor/
directory, similar to the way pear.
Then let's install some common PHP tools, including composer yourself can be installed with composer!
$ ./composer.phar global require ‘composer/composer:dev-master‘$ ./composer.phar global require ‘phpunit/phpunit:3.7.*‘$ ./composer.phar global require ‘fabpot/php-cs-fixer:dev-master‘
Install it later to delete Composer.phar, ~/.composer/vendor/bin
add to your PATH
variables, restart the terminal, you can use these PHP tool commands anywhere, and because all the information exists in ~/.composer/composer.json
the directory, what tools are installed there are all at a glance, Mother does not have to worry about the examination of what documents arrived /usr/bin
. All the composer global
installed tools are in ~/.composer/vendor
, want to kill want to cut free, the big deal all deleted a re- composer install
click! Also don't need sudo every time to upgrade these PHP gadgets.
Elegant to use composer to install various PHP gadgets