{"id":20776757,"url":"https://github.com/sjorek/composer-virtual-environment-plugin","last_synced_at":"2026-04-06T21:31:11.464Z","repository":{"id":57052288,"uuid":"105644876","full_name":"sjorek/composer-virtual-environment-plugin","owner":"sjorek","description":"A composer-plugin adding shell, symbolic link and git-hook related commands to composer.","archived":false,"fork":false,"pushed_at":"2018-02-27T19:04:11.000Z","size":382,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-13T06:47:02.479Z","etag":null,"topics":["composer","composer-plugin","git","git-hooks","php","shell"],"latest_commit_sha":null,"homepage":"https://sjorek.github.io/composer-virtual-environment-plugin/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sjorek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-03T11:40:50.000Z","updated_at":"2017-10-26T13:27:03.000Z","dependencies_parsed_at":"2022-08-24T03:41:05.618Z","dependency_job_id":null,"html_url":"https://github.com/sjorek/composer-virtual-environment-plugin","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/sjorek/composer-virtual-environment-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjorek%2Fcomposer-virtual-environment-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjorek%2Fcomposer-virtual-environment-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjorek%2Fcomposer-virtual-environment-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjorek%2Fcomposer-virtual-environment-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjorek","download_url":"https://codeload.github.com/sjorek/composer-virtual-environment-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjorek%2Fcomposer-virtual-environment-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31491095,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T17:22:55.647Z","status":"ssl_error","status_checked_at":"2026-04-06T17:22:54.741Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","composer-plugin","git","git-hooks","php","shell"],"created_at":"2024-11-17T13:11:40.470Z","updated_at":"2026-04-06T21:31:11.443Z","avatar_url":"https://github.com/sjorek.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [“virtual-environment”](https://sjorek.github.io/composer-virtual-environment-plugin/) [composer-plugin](http://getcomposer.org)\n\nA [composer](http://getcomposer.org)-plugin adding three commands to composer:\n\n1. `venv:shell` - activate/deactivate the composer virtual environment in shell\n2. `venv:hook` - add/remove shell hooks, triggered on activating or deactivating the virtual environment\n3. `venv:link` - create symlinks to arbitrary locations\n4. `venv:git-hook` - create git-hooks from various sources\n\n\n## Installation\n\n### Method 1: globally, so it is available in all packages\n\n```bash\nphp composer.phar global require sjorek/composer-virtual-environment-plugin\n```\n\n\n### Method 2: as a package requirement\n\n```bash\nphp composer.phar require --dev sjorek/composer-virtual-environment-plugin\n```\n\n\n## Documentation\n\n### Shell Activation Command\n\n```bash\n$ php composer.phar help venv:shell\nUsage:\n  virtual-environment:shell [options] [--] [\u003cshell\u003e]...\n  venv:shell\n\nArguments:\n  shell                          List of shell activators to add or remove.\n\nOptions:\n      --name=NAME                Name of the virtual environment. [default: \"{$name}\"]\n      --colors                   Enable the color prompt per default. Works currently only for \"bash\".\n      --no-colors                Disable the color prompt per default.\n  -a, --add                      Add to existing configuration.\n  -r, --remove                   Remove all configured items.\n  -s, --save                     Save configuration.\n  -l, --local                    Use local configuration file \"./composer-venv.json\".\n  -g, --global                   Use global configuration file \"~/.composer/composer-venv.json\".\n  -c, --config-file=CONFIG-FILE  Use given configuration file.\n      --lock                     Lock configuration in \"./composer-venv.lock\".\n  -f, --force                    Force overwriting existing git-hooks\n  -h, --help                     Display this help message\n  -q, --quiet                    Do not output any message\n  -V, --version                  Display this application version\n      --ansi                     Force ANSI output\n      --no-ansi                  Disable ANSI output\n  -n, --no-interaction           Do not ask any interactive question\n      --profile                  Display timing and memory usage information\n      --no-plugins               Whether to disable plugins.\n  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.\n  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output,\n                                 2 for more verbose output and 3 for debug\n\nHelp:\n  The virtual-environment:shell command creates files\n  to activate and deactivate the current bin directory in shell.\n  \n  Usage:\n  \n      php composer.phar venv:shell\n  \n  After this you can source the activation-script\n  corresponding to your shell.\n  \n  if only one shell-activator or bash and zsh have been deployed:\n      source vendor/bin/activate\n  \n  csh:\n      source vendor/bin/activate.csh\n  \n  fish:\n      . vendor/bin/activate.fish\n  \n  bash (alternative):\n      source vendor/bin/activate.bash\n  \n  zsh (alternative):\n      source vendor/bin/activate.zsh\n  \n```\n\n\n### Shell Activation Hook Command\n\n```bash\n$ php composer.phar help venv:shell-hook\nUsage:\n  virtual-environment:shell-hook [options] [--] [\u003chook\u003e]...\n  venv:shell-hook\n\nArguments:\n  hook                           List of shell-hooks to add or remove.\n\nOptions:\n      --name=NAME                The name of the shell-hook.\n      --priority=PRIORITY        The priority of the shell-hook.\n      --shell=SHELL              The name of or path to the shell.\n      --script=SCRIPT            Use the given script as shell-hook.\n      --file=FILE                Use the content of the given file as shell-hook.\n      --link=LINK                Install shell-hook by creating a symbolic link to the given file.\n      --url=URL                  Download the shell-hook from the given url.\n  -a, --add                      Add to existing configuration.\n  -r, --remove                   Remove all configured items.\n  -s, --save                     Save configuration.\n  -l, --local                    Use local configuration file \"./composer-venv.json\".\n  -g, --global                   Use global configuration file \"~/.composer/composer-venv.json\".\n  -c, --config-file=CONFIG-FILE  Use given configuration file.\n      --lock                     Lock configuration in \"./composer-venv.lock\".\n  -f, --force                    Force overwriting existing git-hooks\n  -h, --help                     Display this help message\n  -q, --quiet                    Do not output any message\n  -V, --version                  Display this application version\n      --ansi                     Force ANSI output\n      --no-ansi                  Disable ANSI output\n  -n, --no-interaction           Do not ask any interactive question\n      --profile                  Display timing and memory usage information\n      --no-plugins               Whether to disable plugins.\n  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.\n  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output,\n                                 2 for more verbose output and 3 for debug\n\nHelp:\n  The virtual-environment:shell-hook command manages\n  shell-hooks residing in the .composer-venv/shell directory.\n  \n  Examples:\n  \n  Simple shell script running in the detected shell only\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --script='composer run-script xyz'\n  \n  Simple shell script running in all shells\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --script='composer run-script xyz' \\\n          --shell=sh\n  \n  Utilizing environment variable expansion\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --script='echo \"I am using a %SHELL%!\"' \\\n          --shell='%SHELL%'\n  \n  Utilizing configuration value expansion\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --script='{$bin-dir}/php -r \\'require \"{$vendor-dir}/autoload.php\"; Namespace\\\\Classname::staticMethod();\\''\n  \n  Import file from relative path\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --file=relative/path/to/post-activate.hook\n  \n  Import file from absolute path\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --file=/absolute/path/to/post-activate.hook\n  \n  Create symlink to file\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --link=../../path/to/post-activate.hook\n  \n  Relative hook file URL\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --url=file://relative/path/to/post-activate.hook\n  \n  Absolute hook file URL\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --url=file:///absolute/path/to/post-activate.hook\n  \n  Download hook file from an URL\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --url=https://some.host/post-activate.hook\n  \n  Using a built-in hook file URL\n  \n      php composer.phar venv:shell-hook post-activate \\\n          --url=vfs://venv/shell-hook/post-activate.hook\n  \n```\n\n\n### Symbolic Link Command\n\n```bash\n$ php composer.phar help venv:link\nUsage:\n  virtual-environment:link [options] [--] [\u003clink\u003e]...\n  venv:link\n\nArguments:\n  link                           List of symbolic links to add or remove.\n\nOptions:\n  -a, --add                      Add to existing configuration.\n  -r, --remove                   Remove all configured items.\n  -s, --save                     Save configuration.\n  -l, --local                    Use local configuration file \"./composer-venv.json\".\n  -g, --global                   Use global configuration file \"~/.composer/composer-venv.json\".\n  -c, --config-file=CONFIG-FILE  Use given configuration file.\n      --lock                     Lock configuration in \"./composer-venv.lock\".\n  -f, --force                    Force overwriting existing git-hooks\n  -h, --help                     Display this help message\n  -q, --quiet                    Do not output any message\n  -V, --version                  Display this application version\n      --ansi                     Force ANSI output\n      --no-ansi                  Disable ANSI output\n  -n, --no-interaction           Do not ask any interactive question\n      --profile                  Display timing and memory usage information\n      --no-plugins               Whether to disable plugins.\n  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.\n  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output,\n                                 2 for more verbose output and 3 for debug\n\nHelp:\n  The virtual-environment:link command places symlinks\n  to php- and composer-binaries in the bin directory.\n  \n  Example:\n  \n      php composer.phar venv:link '{$bin-dir}/composer':'{$bin-dir-up}/composer.phar'\n  \n  After this you can use the linked binaries in composer\n  run-script or in virtual-environment:shell.\n  \n  Attention: only link the composer like in the example above,\n  if your project does not require the composer/composer package.\n  \n```\n\n\n### Git-Hook Command\n\n```bash\n$ php composer.phar help venv:git-hook \nUsage:\n  virtual-environment:git-hook [options] [--] [\u003chook\u003e]...\n  venv:git-hook\n\nArguments:\n  hook                           List of git-hooks to add or remove.\n\nOptions:\n      --script=SCRIPT            Use the given script as git-hook.\n      --shebang=SHEBANG          Use the given #!shebang for the given script.\n      --file=FILE                Use the content of the given file as git-hook.\n      --link=LINK                Install git-hook by creating a symbolic link to the given file.\n      --url=URL                  Download the git-hook from the given url.\n  -a, --add                      Add to existing configuration.\n  -r, --remove                   Remove all configured items.\n  -s, --save                     Save configuration.\n  -l, --local                    Use local configuration file \"./composer-venv.json\".\n  -g, --global                   Use global configuration file \"~/.composer/composer-venv.json\".\n  -c, --config-file=CONFIG-FILE  Use given configuration file.\n      --lock                     Lock configuration in \"./composer-venv.lock\".\n  -f, --force                    Force overwriting existing git-hooks\n  -h, --help                     Display this help message\n  -q, --quiet                    Do not output any message\n  -V, --version                  Display this application version\n      --ansi                     Force ANSI output\n      --no-ansi                  Disable ANSI output\n  -n, --no-interaction           Do not ask any interactive question\n      --profile                  Display timing and memory usage information\n      --no-plugins               Whether to disable plugins.\n  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.\n  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output,\n                                 2 for more verbose output and 3 for debug\n\nHelp:\n  The virtual-environment:git-hook command manages\n  git-hooks residing in the .git/hooks directory.\n  \n  Examples:\n  \n  Simple shell script using default shebang \"#!/bin/sh\"\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --script='composer run-script xyz'\n  \n  Shell script with a more complex shebang\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --shebang='/usr/bin/env bash' \\\n          --script='echo \"about to commit\"'\n  \n  Simple PHP script\n\n      # notice the detection of the correct shebang\n      php composer.phar venv:git-hook pre-commit \\\n          --script='\u003c?php echo \"about to commit\";'\n  \n  Utilizing environment variable expansion\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --shebang=%SHELL% \\\n          --script='echo \"I am using a %SHELL%!\"'\n  \n  Utilizing configuration value expansion\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --shebang='{$bin-dir}/php' \\\n          --script='\u003c?php\n                  require \"{$vendor-dir}/autoload.php\";\n                  Namespace\\Classname::staticMethod();'\n  \n  Import file from relative path\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --file=relative/path/to/pre-commit.hook\n  \n  Import file from absolute path\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --file=/absolute/path/to/pre-commit.hook\n  \n  Create symlink to file\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --link=../../path/to/pre-commit.hook\n  \n  Relative hook file URL\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --url=file://relative/path/to/pre-commit.hook\n  \n  Absolute hook file URL\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --url=file:///absolute/path/to/pre-commit.hook\n  \n  Download hook file from an URL\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --url=https://some.host/pre-commit.hook\n  \n  Using a built-in hook file URL\n  \n      php composer.phar venv:git-hook pre-commit \\\n          --url=vfs://venv/git-hook/pre-commit.hook\n  \n```\n\n\n## Contributing\n\nLook at the [contribution guidelines](CONTRIBUTING.md)\n\n\n## Want more?\n\nThere is a [bash-completion implementation](https://sjorek.github.io/composer-bash-completion/)\ncomplementing this composer-plugin. And if you're using [MacPorts](http://macports.org),\nespecially if you're using my [MacPorts-PHP](https://sjorek.github.io/MacPorts-PHP/)\nrepository, everything should work like a breeze.\n\n## Links\n\n### Status\n\n[![Build Status](https://img.shields.io/travis/sjorek/composer-virtual-environment-plugin.svg)](https://travis-ci.org/sjorek/composer-virtual-environment-plugin)\n\n\n### GitHub\n\n[![GitHub Issues](https://img.shields.io/github/issues/sjorek/composer-virtual-environment-plugin.svg)](https://github.com/sjorek/composer-virtual-environment-plugin/issues)\n[![GitHub Latest Tag](https://img.shields.io/github/tag/sjorek/composer-virtual-environment-plugin.svg)](https://github.com/sjorek/composer-virtual-environment-plugin/tags)\n[![GitHub Total Downloads](https://img.shields.io/github/downloads/sjorek/composer-virtual-environment-plugin/total.svg)](https://github.com/sjorek/composer-virtual-environment-plugin/releases)\n\n\n### Packagist\n\n[![Packagist Latest Stable Version](https://poser.pugx.org/sjorek/composer-virtual-environment-plugin/version)](https://packagist.org/packages/sjorek/composer-virtual-environment-plugin)\n[![Packagist Total Downloads](https://poser.pugx.org/sjorek/composer-virtual-environment-plugin/downloads)](https://packagist.org/packages/sjorek/composer-virtual-environment-plugin)\n[![Packagist Latest Unstable Version](https://poser.pugx.org/sjorek/composer-virtual-environment-plugin/v/unstable)](https:////packagist.org/packages/sjorek/composer-virtual-environment-plugin)\n[![Packagist License](https://poser.pugx.org/sjorek/composer-virtual-environment-plugin/license)](https://packagist.org/packages/sjorek/composer-virtual-environment-plugin)\n\n\n### Social\n\n[![GitHub Forks](https://img.shields.io/github/forks/sjorek/composer-virtual-environment-plugin.svg?style=social)](https://github.com/sjorek/composer-virtual-environment-plugin/network)\n[![GitHub Stars](https://img.shields.io/github/stars/sjorek/composer-virtual-environment-plugin.svg?style=social)](https://github.com/sjorek/composer-virtual-environment-plugin/stargazers)\n[![GitHub Watchers](https://img.shields.io/github/watchers/sjorek/composer-virtual-environment-plugin.svg?style=social)](https://github.com/sjorek/composer-virtual-environment-plugin/watchers)\n[![Twitter](https://img.shields.io/twitter/url/https/github.com/sjorek/composer-virtual-environment-plugin.svg?style=social)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fsjorek.github.io%2Fcomposer-virtual-environment-plugin%2F)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjorek%2Fcomposer-virtual-environment-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjorek%2Fcomposer-virtual-environment-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjorek%2Fcomposer-virtual-environment-plugin/lists"}