You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.MD
+42-79Lines changed: 42 additions & 79 deletions
Original file line number
Diff line number
Diff line change
@@ -9,100 +9,70 @@
9
9
10
10
## Introduction
11
11
12
-
`phpvm` is a PHP Version Manager that allows you to easily install, switch between, and manage multiple PHP versions via the command line.
12
+
`phpvm` is a lightweight PHP Version Manager that allows you to easily install, switch between, and manage multiple PHP versions via the command line.
13
13
14
14
**Example:**
15
15
16
16
```sh
17
-
$ phpvm use 7.4
18
-
Now using PHP v7.4.10
17
+
$ phpvm use 8.2
18
+
Now using PHP v8.2.10
19
19
$ php -v
20
-
PHP 7.4.10
21
-
$ phpvm use 8.0
22
-
Now using PHP v8.0.8
20
+
PHP 8.2.10
21
+
$ phpvm use 8.1
22
+
Now using PHP v8.1.13
23
23
$ php -v
24
-
PHP 8.0.8
24
+
PHP 8.1.13
25
25
```
26
26
27
-
## About phpvm
27
+
## Features
28
28
29
-
`phpvm` is a version manager designed to be used on Unix-like systems, including macOS and Linux. It allows you to install and manage PHP versions, switch between them seamlessly, and work with multiple versions on your system.
30
-
31
-
### Key Features
32
-
33
-
- Install and use different PHP versions.
34
-
- Easily switch between installed PHP versions.
35
-
- List installed PHP versions.
36
-
- Uninstall a specific PHP version.
29
+
- Install and manage multiple PHP versions.
30
+
- Seamlessly switch between installed PHP versions.
31
+
- Auto-switch PHP versions based on project `.phpvmrc`.
32
+
- Supports macOS (via Homebrew) and Linux distributions.
33
+
- Works with common shells (`bash`, `zsh`).
37
34
38
35
## Installation
39
36
40
-
### Install & Update Script
37
+
### Install & Update phpvm
41
38
42
-
To **install** or **update** phpvm, run the following command using either `curl` or `wget`:
39
+
To **install** or **update** phpvm, run one of the following commands:
This script clones the `phpvm`repository into `~/.phpvm` and attempts to add the following lines to your profile (`~/.bashrc`, `~/.zshrc`, or `~/.profile`):
49
+
This script will download and set up `phpvm`in `~/.phpvm`, adding the following to your shell profile (`~/.bashrc`, `~/.zshrc`, or `~/.profile`):
53
50
54
51
```sh
55
52
export PHPVM_DIR="$HOME/.phpvm"
56
-
export PATH="$HOME/.local/bin:$PATH"
53
+
source"$PHPVM_DIR/phpvm"
57
54
```
58
55
59
56
### Verify Installation
60
57
61
-
To verify that `phpvm` has been installed, run the following command:
58
+
Run the following command:
62
59
63
60
```sh
64
61
command -v phpvm
65
62
```
66
63
67
-
This should output `phpvm` if the installation was successful.
68
-
69
-
### Manual Install
70
-
71
-
To manually install `phpvm`, clone the repository:
Then add the following lines to your shell's profile (`~/.bashrc`, `~/.zshrc`, etc.):
78
-
79
-
```sh
80
-
export PHPVM_DIR="$HOME/.phpvm"
81
-
export PATH="$HOME/.local/bin:$PATH"
82
-
```
83
-
84
-
### Manual Update
85
-
86
-
To manually update `phpvm` to the latest version, use the following commands:
87
-
88
-
```sh
89
-
cd~/.phpvm
90
-
git fetch --tags origin
91
-
git checkout `git describe --abbrev=0 --tags`
92
-
```
64
+
If the installation was successful, it should output `phpvm`.
93
65
94
66
## Usage
95
67
96
68
### Installing PHP Versions
97
69
98
-
To install a specific version of PHP, run:
70
+
To install a specific version of PHP:
99
71
100
72
```sh
101
73
phpvm install 8.1
102
74
```
103
75
104
-
This will install PHP version 8.1.
105
-
106
76
### Switching PHP Versions
107
77
108
78
To switch between installed versions:
@@ -111,77 +81,70 @@ To switch between installed versions:
111
81
phpvm use 8.0
112
82
```
113
83
114
-
This will switch to PHP 8.0. You can verify the active version by running:
84
+
Check the active version:
115
85
116
86
```sh
117
87
php -v
118
88
```
119
89
120
-
### Uninstalling PHP Versions
90
+
### Auto-Switching PHP Versions
121
91
122
-
To uninstall a version of PHP:
92
+
If a `.phpvmrc` file is present in your project directory, `phpvm` will automatically switch to the specified version:
123
93
124
94
```sh
125
-
phpvm uninstall 7.4
95
+
echo"8.1"> .phpvmrc
126
96
```
127
97
128
-
This will uninstall PHP 7.4 from the system.
98
+
Upon entering the project directory, `phpvm`will switch to PHP 8.1 automatically.
129
99
130
-
### Listing Installed Versions
100
+
### Uninstalling PHP Versions
131
101
132
-
To list the installed PHP versions:
102
+
To uninstall a specific PHP version:
133
103
134
104
```sh
135
-
phpvm list
105
+
phpvm uninstall 7.4
136
106
```
137
107
138
-
This will display all the PHP versions managed by `phpvm`.
139
-
140
-
## Running Tests
108
+
### Listing Installed Versions
141
109
142
-
You can run tests using Jest. Install the dependencies and run the following command:
110
+
To list installed PHP versions:
143
111
144
112
```sh
145
-
npm install
146
-
npm test
113
+
phpvm list
147
114
```
148
115
149
-
This will run all tests defined for `phpvm`.
150
-
151
116
## Uninstallation
152
117
153
-
To manually uninstall`phpvm`, run:
118
+
To completely remove`phpvm`, run:
154
119
155
120
```sh
156
121
rm -rf ~/.phpvm
157
122
```
158
123
159
-
And remove the following lines from your shell's profile:
124
+
And remove the following lines from your shell profile (`~/.bashrc`, `~/.zshrc`, etc.):
160
125
161
126
```sh
162
127
export PHPVM_DIR="$HOME/.phpvm"
163
-
export PATH="$HOME/.local/bin:$PATH"
128
+
source"$PHPVM_DIR/phpvm"
164
129
```
165
130
166
131
## Troubleshooting
167
132
168
-
If you encounter any issues with `phpvm` or its functionality, consider the following troubleshooting steps:
133
+
If you experience issues with `phpvm`, try the following:
169
134
170
-
-Make sure your shell configuration file is correctly sourcing `phpvm`.
171
-
-For macOS, ensure that the necessary command line tools (like Homebrew or Xcode) are installed.
172
-
-Restart your terminal after making any changes.
173
-
-Ensure you have proper permissions to install PHP versions and modify system paths.
135
+
-Ensure your shell profile is sourcing `phpvm`.
136
+
-Restart your terminal after installation.
137
+
-Make sure Homebrew is installed (for macOS users).
138
+
-Check for permission issues when installing PHP versions.
174
139
175
140
## Maintainers
176
141
177
142
`phpvm` is maintained by [Jerome Thayananthajothy](https://github.com/Thavarshan).
178
143
179
144
## License
180
145
181
-
This project is licensed under the MIT License. See [LICENSE](./LICENSE) for more details.
146
+
This project is licensed under the MIT License. See [LICENSE](./LICENSE) for details.
182
147
183
148
## Disclaimer
184
149
185
-
`phpvm` is an open-source tool designed to simplify PHP version management. While we strive to ensure its functionality across different platforms and configurations, we make no warranties or guarantees regarding its accuracy, completeness, reliability, or suitability for any particular purpose.
186
-
187
-
**Use at your own risk.** By using `phpvm`, you acknowledge that the developers and contributors are not responsible for any damages or data loss resulting from the installation, configuration, or use of this tool.
150
+
`phpvm` is provided as-is, without any warranties. Use it at your own risk.
0 commit comments