Skip to content

Commit dfc37dd

Browse files
committed
docs: update README with new commands and exit codes documentation
1 parent 8af61b7 commit dfc37dd

1 file changed

Lines changed: 79 additions & 12 deletions

File tree

README.MD

Lines changed: 79 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,21 @@ If the installation was successful, it should output the path to `phpvm`.
8989

9090
### Available Commands
9191

92-
| Command | Description |
93-
| ------------------------- | ------------------------------------- |
94-
| `phpvm install <version>` | Install a specific PHP version |
95-
| `phpvm use <version>` | Switch to a specific PHP version |
96-
| `phpvm system` | Switch to system/Homebrew default PHP |
97-
| `phpvm list` | List all installed PHP versions |
98-
| `phpvm auto` | Auto-switch based on `.phpvmrc` file |
99-
| `phpvm test` | Run built-in self-tests |
100-
| `phpvm version` | Show version information |
101-
| `phpvm --version` | Show version information (alias) |
102-
| `phpvm -v` | Show version information (alias) |
103-
| `phpvm help` | Show help message |
92+
| Command | Description |
93+
| -------------------------- | ------------------------------------------ |
94+
| `phpvm install <version>` | Install a specific PHP version |
95+
| `phpvm use <version>` | Switch to a specific PHP version |
96+
| `phpvm current` | Display the currently active PHP version |
97+
| `phpvm which [version]` | Show the path to PHP binary for a version |
98+
| `phpvm deactivate` | Temporarily disable phpvm and restore PATH |
99+
| `phpvm system` | Switch to system/Homebrew default PHP |
100+
| `phpvm list` or `phpvm ls` | List all installed PHP versions |
101+
| `phpvm auto` | Auto-switch based on `.phpvmrc` file |
102+
| `phpvm test` | Run built-in self-tests |
103+
| `phpvm version` | Show version information |
104+
| `phpvm --version` | Show version information (alias) |
105+
| `phpvm -v` | Show version information (alias) |
106+
| `phpvm help` | Show help message |
104107

105108
### Installing PHP Versions
106109

@@ -132,6 +135,40 @@ Verify the active version with:
132135
php -v
133136
```
134137

138+
### Checking Current PHP Version
139+
140+
To see which PHP version is currently active:
141+
142+
```sh
143+
phpvm current
144+
```
145+
146+
This will display the active PHP version, "system" (if using system PHP), or "none" (if no PHP is active).
147+
148+
### Finding PHP Binary Paths
149+
150+
To find the path to a PHP binary for any version:
151+
152+
```sh
153+
# Show path for a specific version
154+
phpvm which 8.2
155+
156+
# Show path for current version
157+
phpvm which
158+
```
159+
160+
This works across all package managers (Homebrew, apt, dnf, yum, pacman) and is useful for IDE configuration or scripting.
161+
162+
### Temporarily Disabling phpvm
163+
164+
To temporarily disable phpvm and restore your original PATH:
165+
166+
```sh
167+
phpvm deactivate
168+
```
169+
170+
This is useful for debugging or when you need to use the system default PHP temporarily. To re-enable phpvm, simply use `phpvm use <version>` again.
171+
135172
### Version Information
136173

137174
To check the phpvm version and get information:
@@ -180,6 +217,31 @@ phpvm test
180217

181218
This will run a series of tests on your system to ensure all phpvm functions are working properly.
182219

220+
### Exit Codes
221+
222+
phpvm uses specific exit codes for better scripting support:
223+
224+
| Exit Code | Meaning |
225+
| --------- | --------------------------------- |
226+
| `0` | Success |
227+
| `1` | General error |
228+
| `2` | Invalid argument or usage error |
229+
| `3` | Version not found (not available) |
230+
| `4` | Version not installed locally |
231+
| `5` | File or permission error |
232+
| `127` | Unknown command |
233+
234+
Example usage in scripts:
235+
236+
```sh
237+
phpvm use 8.2
238+
if [ $? -eq 0 ]; then
239+
echo "Successfully switched to PHP 8.2"
240+
else
241+
echo "Failed to switch PHP version"
242+
fi
243+
```
244+
183245
## Uninstallation
184246

185247
To completely remove `phpvm`, run:
@@ -293,7 +355,9 @@ The built-in test framework verifies:
293355
The project features a streamlined CI/CD pipeline with comprehensive testing workflows:
294356

295357
#### 1. **Core Testing** (`.github/workflows/test.yml`)
358+
296359
Comprehensive testing workflow including:
360+
297361
- **Multi-Distribution Testing**: 13 Linux distributions across 4 package managers
298362
- **Ubuntu**: 20.04, 22.04, 24.04
299363
- **Debian**: 11 (Bullseye), 12 (Bookworm)
@@ -306,7 +370,9 @@ Comprehensive testing workflow including:
306370
- **Integration Testing**: End-to-end workflows, installation simulation, error recovery
307371

308372
#### 2. **Security Testing** (`.github/workflows/security-test.yml`)
373+
309374
Specialized security validation including:
375+
310376
- Input validation and injection prevention
311377
- Path traversal protection
312378
- Privilege escalation prevention
@@ -316,6 +382,7 @@ Specialized security validation including:
316382
- Symlink attack prevention
317383

318384
#### 3. **Release Validation** (`.github/workflows/release.yml`)
385+
319386
Release testing and validation for new versions.
320387

321388
### Testing Coverage

0 commit comments

Comments
 (0)