A simple virtual environment for composer
A simple virtual environment for composer
., (*1)
Inspired by Python's
virtualenv
, this package
adds a script for prepending vendor/bin
to the PATH
variable to
make it easier to run commands installed via composer
., (*2)
Assume your composer.json
contains, (*3)
"require-dev": { "phpunit/phpunit": "^6.5", "drush/drush": "^9.2" }
After running composer install
you have to make sure to run
vendor/bin/phpunit
or vendor/bin/drush
, respectively, to run the
right command. If you just run phpunit
you'll will run any globally
installed version of phpunit
(or get an error if phpunit
is not
installed)., (*4)
Composer virtualenv, helps you run the right commands, i.e. the ones
installed using composer
, without having to (remember to) type
vendor/bin/
every time., (*5)
composer require itk-dev/composer-virtualenv "^1.0"
To deactivate the virtual environment, run, (*6)
source vendor/bin/activate
Note: It is important to source
the script – it will not work if
it is run., (*7)
This prepends the path vendor/bin
to the PATH
environment
variable, and any command installed using composer
will be run
instead of any globally available command of the same name., (*8)
To deactivate the virtual environment and restore the PATH
variable to its original value, run, (*9)
deactivate