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
|`phpvm install [version]`| Install a PHP version (reads `.phpvmrc` if no version given) |
111
+
|`phpvm use [version]`| Switch PHP version (reads `.phpvmrc` → default alias if no version given) |
112
+
|`phpvm uninstall <version>`| Remove a specific PHP version |
113
+
|`phpvm current`| Display the currently active PHP version |
114
+
|`phpvm which [version]`| Show the path to PHP binary for a version |
115
+
|`phpvm exec <version> <command> [args...]`| Run a command with a specific PHP version (subshell isolation) |
116
+
|`phpvm run <version> [script] [args...]`| Run a PHP script with a specific version |
117
+
|`phpvm deactivate`| Temporarily disable phpvm and restore PATH |
118
+
|`phpvm unload`| Remove phpvm from the current shell session |
119
+
|`phpvm system`| Switch to system/Homebrew default PHP |
120
+
|`phpvm auto`| Auto-switch based on `.phpvmrc` file |
121
+
|`phpvm list` or `phpvm ls`| List all installed PHP versions |
122
+
|`phpvm ls-remote [pattern]`| List available remote PHP versions |
123
+
|`phpvm resolve <version\|alias>`| Resolve a version descriptor to an installed version |
124
+
|`phpvm alias [name] [ver]`| Create, update, or list version aliases |
125
+
|`phpvm unalias <name>`| Remove version alias |
126
+
|`phpvm cache <dir\|clear>`| Show or clear the phpvm cache directory |
127
+
|`phpvm info`| Show system information for debugging |
128
+
|`phpvm version`| Show version information |
129
+
|`phpvm --version` / `-v`| Show version information (aliases) |
130
+
|`phpvm help`| Show help message |
116
131
117
132
### Installing PHP Versions
118
133
@@ -236,7 +251,17 @@ To list all installed PHP versions:
236
251
phpvm list
237
252
```
238
253
239
-
This will show all installed PHP versions and indicate the currently active one.
254
+
The active version is marked with `->` and highlighted in green. If a `default` alias is set, it is annotated inline:
255
+
256
+
```
257
+
Installed PHP versions:
258
+
-> 8.2 (default)
259
+
8.1
260
+
8.0
261
+
system
262
+
263
+
Active version: 8.2
264
+
```
240
265
241
266
### Managing Aliases
242
267
@@ -274,14 +299,20 @@ phpvm use latest
274
299
phpvm use stable
275
300
```
276
301
277
-
### Cache Directory
302
+
### Cache Management
278
303
279
304
Show the phpvm cache directory:
280
305
281
306
```sh
282
307
phpvm cache dir
283
308
```
284
309
310
+
Clear all cached files:
311
+
312
+
```sh
313
+
phpvm cache clear
314
+
```
315
+
285
316
### System Information
286
317
287
318
Show system details for debugging:
@@ -300,14 +331,97 @@ To remove a specific PHP version:
300
331
phpvm uninstall 7.4
301
332
```
302
333
303
-
### Planned Commands (Coming Soon)
334
+
### Running Commands with a Specific PHP Version
335
+
336
+
Use `phpvm exec` to run any command with a specific PHP version without globally switching. The command executes in a subshell, so your current shell session is unaffected:
337
+
338
+
```sh
339
+
# Run composer install with PHP 8.2
340
+
phpvm exec 8.2 composer install
341
+
342
+
# Run a linter with PHP 8.1
343
+
phpvm exec 8.1 ./vendor/bin/phpstan analyse
344
+
```
345
+
346
+
Use `phpvm run` as a shortcut for `phpvm exec <version> php`:
347
+
348
+
```sh
349
+
# Run a PHP script with PHP 8.1
350
+
phpvm run 8.1 script.php arg1 arg2
351
+
352
+
# Equivalent to:
353
+
phpvm exec 8.1 php script.php arg1 arg2
354
+
```
355
+
356
+
Both commands resolve aliases and keywords (`default`, `latest`, `stable`) before execution.
357
+
358
+
### Listing Available Remote Versions
359
+
360
+
List PHP versions available for installation from your system package manager:
361
+
362
+
```sh
363
+
phpvm ls-remote
364
+
```
365
+
366
+
Filter by pattern:
367
+
368
+
```sh
369
+
phpvm ls-remote 8.2
370
+
```
371
+
372
+
Supported package managers: Homebrew, apt, dnf, yum, and pacman.
373
+
374
+
### Resolving Versions
375
+
376
+
Resolve a version descriptor, alias, or keyword to a locally installed version number:
377
+
378
+
```sh
379
+
# Resolve an alias
380
+
phpvm resolve default # → 8.2
381
+
382
+
# Resolve a keyword
383
+
phpvm resolve latest # → 8.3
384
+
385
+
# Pass through a concrete version (if installed)
386
+
phpvm resolve 8.1 # → 8.1
387
+
```
388
+
389
+
This is useful in CI scripts or tooling that needs to know which version an alias points to.
390
+
391
+
### Unloading phpvm
304
392
305
-
The following commands are in progress and may return a "not yet implemented" message:
393
+
Remove phpvm from the current shell session entirely:
394
+
395
+
```sh
396
+
phpvm unload
397
+
```
398
+
399
+
This deactivates phpvm, removes the cd hook, and unsets all phpvm functions and variables. To use phpvm again, re-source it:
400
+
401
+
```sh
402
+
source~/.phpvm/phpvm.sh
403
+
```
404
+
405
+
### Tab Completion
406
+
407
+
phpvm includes built-in bash tab completion that is automatically loaded when phpvm is sourced. It provides context-aware completions for:
0 commit comments