|
1 | 1 | # Composer Version Manager |
2 | 2 |
|
3 | 3 | [Composer 2](https://getcomposer.org/upgrade/UPGRADE-2.0.md) is here. It's time for a one stop shop for switching between major (and minor |
4 | | -👶) composer versions. |
| 4 | +👶) composer versions. Erase "using the right composer version" from your workflow. |
5 | 5 |
|
6 | 6 | > But wait, what about `composer self-update --1` and `--2`? |
7 | 7 |
|
8 | 8 | Well I'm glad you've asked! |
9 | 9 |
|
10 | | -There are some added benefits this CLI will bring to you: |
| 10 | +There are some added benefits this CLI and shell hook will bring to you: |
11 | 11 |
|
12 | 12 | 1. Cached `composer.phar` for faster version toggling. |
13 | | -1. Per-directory automated and configurable context switching. |
14 | | -1. Production and pipeline friendly installation via [Docker](https://hub.docker.com/). |
15 | | -1. It's as simple as `cvm 1` and `cvm 2`. |
| 13 | +1. Per-directory smart composer environments. It's as simple as `cd my-project` and the right composer version will be used. |
16 | 14 |
|
17 | | -## Author |
| 15 | +## Installation |
18 | 16 |
|
19 | | -My name is Morgan Wowk and I am a Software Developer from the wintery lands of Canada 🇨🇦🍁. You can primarily find me on [LinkedIn](https://www.linkedin.com/in/morganwowk/), writing open source or building apps to help [tens of thousands of ecommerce stores](https://boldcommerce.com/). |
| 17 | +Choose one of the options below to install cvm. |
20 | 18 |
|
21 | | -## Usage |
| 19 | +### Homebrew (MacOS) |
22 | 20 |
|
| 21 | +```bash |
| 22 | +brew update |
| 23 | +brew install composer-version-manager/cvm |
23 | 24 | ``` |
24 | | -# All the commands below will install the missing |
25 | | -# version if it is not yet installed. |
26 | 25 |
|
27 | | -cvm 1 # Use the latest, stable composer 1 |
28 | | -cvm 2 # Use the latest, stable composer 2 |
29 | | -cvm 1.0.0-alpha7 # Use a specific release |
| 26 | +### Chocolatey (Windows) |
| 27 | + |
| 28 | +*TODO* |
| 29 | + |
| 30 | +### Download binary and update PATH |
| 31 | + |
| 32 | +*TODO* |
| 33 | + |
| 34 | +## Hook onto your shell |
| 35 | + |
| 36 | +Hooking onto your shell enables cvm [Smart usage](#smart-usage) for per-directory automated composer verrsioning. |
| 37 | + |
| 38 | +Find the instructions for your shell below. If your shell is not listed please feel free to [submit a feature request](https://github.com/composer-version-manager/cvm/issues/new) issue and we will try and make it happen. |
| 39 | + |
| 40 | +### **BASH** |
| 41 | + |
| 42 | +Add the following line to the end of your `~/.bashrc` |
| 43 | + |
| 44 | +```bash |
| 45 | +eval "$(cvm hook bash)" |
30 | 46 | ``` |
31 | 47 |
|
| 48 | +### **ZSH** |
| 49 | + |
| 50 | +Add the following line to the end of your `~/.zshrc` |
| 51 | + |
| 52 | +```bash |
| 53 | +eval "$(cvm hook zsh)" |
| 54 | +``` |
| 55 | + |
| 56 | +## Smart usage |
| 57 | + |
| 58 | +Create a `.cvm_config` in any directory specifying the composer version you would like to use. Navigating to that directory or any nested directory will automatically enable that composer version in your current workspace. |
| 59 | + |
| 60 | +```bash |
| 61 | +cd my-project |
| 62 | +echo '2.0.11' > .cvm_config |
| 63 | +``` |
| 64 | + |
| 65 | +This file can be committed to your source control. |
| 66 | + |
| 67 | +## Global composer version |
| 68 | + |
| 69 | +You can configure a global composer version. Which will be the default when no parent directory has a `.cvm_config`. |
| 70 | + |
| 71 | +``` |
| 72 | +cvm list # List available tags |
| 73 | +cvm use 2.0.11 # Globally use a specific composer version |
| 74 | +``` |
| 75 | + |
| 76 | +## Authors |
| 77 | + |
| 78 | +### Morgan Wowk |
| 79 | + |
| 80 | +Morgan is a Software Developer from the wintery lands of Canada 🇨🇦🍁. You can primarily find him on [LinkedIn](https://www.linkedin.com/in/morganwowk/), writing open source or building apps to help [tens of thousands of ecommerce stores](https://boldcommerce.com/). |
| 81 | + |
| 82 | +### Bhavek Budhia |
| 83 | + |
| 84 | +Likewise, Bhavek resides in the frosty country of Canada ☃️. An avid developer 👨💻 with fortified experience in Python that has helped us develop a clean and extendable codebase. |
0 commit comments