Install Drush via Composer
Since Drush is distributed as a PEAR package, it can be installed as project dependencies via Composer. This allow you to install Drush on a per-project basis, to ensure the proper version of is used. This is especially useful when using Drush in a build script run through a CI server such a Jenkins.
composer.json
{
// ...
"repositories": [
{
"type": "pear",
"url": "pear.drush.org"
}
],
"config": {
"bin-dir": "bin"
},
"require-dev": {
"pear-drush/drush": "6.*"
}
}
After running composer install
Drush will be available in the bin
directory in your project dir. In order to use it from you shell, you need to add your the bin
direcotry to your path and set the DRUSH_PHP
environement variable. This can be done running the following commands from you project directory.
export PATH=`pwd`/bin:$PATH;
export DRUSH_PHP=`dirname $(which drush)`/composer-php;
Written by Pierre Buyle
Related protips
1 Response
If you run composer global install</code>, it will install it globally.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Drush
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#