Skip to content

Commit 9d3d36c

Browse files
committed
chore: update README.md for version 1.9.4 — enhance documentation and add new commands
1 parent adc6005 commit 9d3d36c

1 file changed

Lines changed: 67 additions & 27 deletions

File tree

README.md

Lines changed: 67 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
```sh
1616
$ phpvm version
17-
phpvm version 1.8.0
17+
phpvm version 1.9.4
1818

1919
PHP Version Manager for macOS and Linux
2020
Author: Jerome Thayananthajothy <tjthavarshan@gmail.com>
@@ -38,21 +38,25 @@ PHP 8.1.13
3838

3939
- Install and manage multiple PHP versions.
4040
- Seamlessly switch between installed PHP versions.
41-
- Auto-switch PHP versions based on project `.phpvmrc`.
41+
- Auto-switch PHP versions based on project `.phpvmrc` (configurable depth via `PHPVM_PHPVMRC_MAX_DEPTH`).
4242
- Alias management for versions (`phpvm alias`, `phpvm unalias`).
43+
- Built-in version shortcuts: `latest`, `stable`, and user-defined aliases.
4344
- Cache directory inspection (`phpvm cache dir`).
45+
- System information and debugging (`phpvm info`).
4446
- Supports macOS (via Homebrew) and Linux distributions including WSL.
4547
- **Smart repository detection** for RHEL/Fedora systems with automatic setup guidance.
4648
- **Enhanced error handling** with actionable solutions when PHP packages are missing.
4749
- **Intelligent package availability checking** before attempting installations.
50+
- **Concurrency-safe operations** with file-based locking to prevent race conditions.
51+
- **Specific exit codes** for scripting (0–5, 127).
4852
- Enhanced cross-platform compatibility with improved shell support.
4953
- Works with common shells (`bash`, `zsh`).
5054
- Comprehensive version commands (`phpvm version`, `phpvm --version`, `phpvm -v`).
5155
- Post-install validation with helpful warnings for missing binaries.
5256
- Enhanced Homebrew integration with better link failure detection.
53-
- Informative, color-coded feedback with timestamps for logs.
57+
- Informative, color-coded feedback with `NO_COLOR` support.
5458
- Comprehensive BATS test suite for verifying functionality.
55-
- Helper functions for better maintainability and reduced code duplication.
59+
- Atomic file writes for safe state management.
5660

5761
## Installation
5862

@@ -90,23 +94,24 @@ If the installation was successful, it should output the path to `phpvm`.
9094

9195
### Available Commands
9296

93-
| Command | Description |
94-
| -------------------------- | ------------------------------------------ |
95-
| `phpvm install <version>` | Install a specific PHP version |
96-
| `phpvm use <version>` | Switch to a specific PHP version |
97-
| `phpvm current` | Display the currently active PHP version |
98-
| `phpvm which [version]` | Show the path to PHP binary for a version |
99-
| `phpvm deactivate` | Temporarily disable phpvm and restore PATH |
100-
| `phpvm system` | Switch to system/Homebrew default PHP |
101-
| `phpvm list` or `phpvm ls` | List all installed PHP versions |
102-
| `phpvm alias [name] [ver]` | Create, update, or list version aliases |
103-
| `phpvm unalias <name>` | Remove version alias |
104-
| `phpvm cache dir` | Show phpvm cache directory |
105-
| `phpvm auto` | Auto-switch based on `.phpvmrc` file |
106-
| `phpvm version` | Show version information |
107-
| `phpvm --version` | Show version information (alias) |
108-
| `phpvm -v` | Show version information (alias) |
109-
| `phpvm help` | Show help message |
97+
| Command | Description |
98+
| ---------------------------- | ------------------------------------------ |
99+
| `phpvm install <version>` | Install a specific PHP version |
100+
| `phpvm use <version>` | Switch to a specific PHP version |
101+
| `phpvm uninstall <version>` | Remove a specific PHP version |
102+
| `phpvm current` | Display the currently active PHP version |
103+
| `phpvm which [version]` | Show the path to PHP binary for a version |
104+
| `phpvm deactivate` | Temporarily disable phpvm and restore PATH |
105+
| `phpvm system` | Switch to system/Homebrew default PHP |
106+
| `phpvm auto` | Auto-switch based on `.phpvmrc` file |
107+
| `phpvm list` or `phpvm ls` | List all installed PHP versions |
108+
| `phpvm alias [name] [ver]` | Create, update, or list version aliases |
109+
| `phpvm unalias <name>` | Remove version alias |
110+
| `phpvm cache dir` | Show phpvm cache directory |
111+
| `phpvm info` | Show system information for debugging |
112+
| `phpvm version` | Show version information |
113+
| `phpvm --version` / `-v` | Show version information (aliases) |
114+
| `phpvm help` | Show help message |
110115

111116
### Installing PHP Versions
112117

@@ -261,14 +266,32 @@ Show the phpvm cache directory:
261266
phpvm cache dir
262267
```
263268

269+
### System Information
270+
271+
Show system details for debugging:
272+
273+
```sh
274+
phpvm info
275+
```
276+
277+
This displays OS type, architecture, package manager, installed PHP versions, and other diagnostic information useful for bug reports.
278+
279+
### Uninstalling PHP Versions
280+
281+
To remove a specific PHP version:
282+
283+
```sh
284+
phpvm uninstall 7.4
285+
```
286+
264287
### Planned Commands (Coming Soon)
265288

266289
The following commands are in progress and may return a "not yet implemented" message:
267290

268-
- `phpvm exec <version> <command> [args...]`
269-
- `phpvm run <version> [script] [args...]`
270-
- `phpvm ls-remote [pattern]`
271-
- `phpvm cache clear`
291+
- `phpvm exec <version> <command> [args...]` — execute a command with a specific PHP version
292+
- `phpvm run <version> [script] [args...]` — run a PHP script with a specific version
293+
- `phpvm ls-remote [pattern]` — list available remote PHP versions
294+
- `phpvm cache clear` — clear the phpvm cache
272295

273296
### Exit Codes
274297

@@ -295,6 +318,17 @@ else
295318
fi
296319
```
297320

321+
## Environment Variables
322+
323+
| Variable | Default | Description |
324+
| --- | --- | --- |
325+
| `PHPVM_DIR` | `~/.phpvm` | Installation directory |
326+
| `PHPVM_AUTO_USE` | `true` | Enable automatic `.phpvmrc` detection when sourced |
327+
| `PHPVM_PHPVMRC_MAX_DEPTH` | `25` | Max parent directories to traverse when searching for `.phpvmrc` |
328+
| `DEBUG` | `false` | Enable debug logging with timestamps |
329+
| `NO_COLOR` | _(unset)_ | Disable color output ([no-color.org](https://no-color.org/)) |
330+
| `PHPVM_LOG_TIMESTAMPS` | `false` | Always show timestamps in log output |
331+
298332
## Uninstallation
299333

300334
To completely remove `phpvm`, run:
@@ -452,8 +486,14 @@ The testing suite covers:
452486
### Running Tests Locally
453487

454488
```sh
455-
# Run built-in tests
456-
./phpvm.sh test
489+
# Syntax check
490+
bash -n phpvm.sh
491+
492+
# Run all BATS tests
493+
bats tests/
494+
495+
# Run specific test file
496+
bats tests/01_core.bats
457497

458498
# Test input validation
459499
./phpvm.sh install "invalid..version" # Should fail gracefully

0 commit comments

Comments
 (0)