rea
Reverse engineer anything with agents, from app behavior down to native binaries.
- 475k
- TypeScript
- MIT
- 13 min ago
๐ Simple PHP version manager for MacOS and Linux.
Repo Thavarshan/phpvm, read from GitHub 24 h ago. Thavarshan has not joined Take My Repo.
Thavarshan/phpvm is a public repo on GitHub by Thavarshan. ๐ Simple PHP version manager for MacOS and Linux. It declares the MIT license on GitHub. It is written mainly in Shell, has 172 stars and last changed on 2026-10-29. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-22.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
phpvm is a lightweight PHP Version Manager that allows you to easily install, switch between, and manage multiple PHP versions via the command line.
Example:
$ phpvm version
phpvm version 1.15.1
PHP Version Manager for macOS and Linux
Author: Jerome Thayananthajothy <tjthavarshan@gmail.com>
Repository: https://github.com/Thavarshan/phpvm
Usage: phpvm help
$ phpvm use 8.2
Switching to PHP 8.2...
Switched to PHP 8.2.
$ php -v
PHP 8.2.10
$ phpvm use 8.1
Switching to PHP 8.1...
Switched to PHP 8.1.
$ php -v
PHP 8.1.13
phpvm exec, phpvm run).phpvm ls-remote).phpvm install latest-remote.phpvm self-update to pull the latest stable script version.phpvm resolve)..phpvmrc (configurable depth via PHPVM_PHPVMRC_MAX_DEPTH).phpvm use, phpvm install, and phpvm resolve read the PHP requirement from composer.json (config.platform.php or require.php) when no version is given.PROMPT_COMMAND for bash, chpwd for zsh).default alias on first phpvm install (matches nvm behaviour).phpvm alias, phpvm unalias).latest, stable, and user-defined aliases.phpvm ls 8, phpvm ls 8.2, or phpvm ls default.phpvm install 8.4 --reinstall-extensions-from=8.3 or phpvm reinstall-extensions 8.3 8.4 (like nvm's --reinstall-packages-from).PHPVM_AUTO_USE_COMPOSER=true to switch on cd based on composer.json.--no-use flag for sourcing without auto-switch or cd hook registration (source phpvm.sh --no-use).phpvm unload).phpvm cache dir) and clear (phpvm cache clear).PHPVM_BIN export โ active PHP binary directory exported after every version switch.XDG_CONFIG_HOME fallback โ PHPVM_DIR respects $XDG_CONFIG_HOME/phpvm when set.phpvm list output with -> marker for the active version and (default) annotation.phpvm info).bash, zsh).phpvm version, phpvm --version, phpvm -v).NO_COLOR support.To install or update phpvm, run one of the following commands:
curl -o- https://raw.githubusercontent.com/Thavarshan/phpvm/main/install.sh | bash
wget -qO- https://raw.githubusercontent.com/Thavarshan/phpvm/main/install.sh | bash
This script will download and set up phpvm in ~/.phpvm and automatically update your shell profile (~/.bashrc, ~/.zshrc, or ~/.profile) with the following lines:
export PHPVM_DIR="$HOME/.phpvm"
export PATH="$PHPVM_DIR/bin:$PATH"
[ -s "$PHPVM_DIR/phpvm.sh" ] && . "$PHPVM_DIR/phpvm.sh"
Run the following command:
command -v phpvm
If the installation was successful, it should output the path to phpvm.
| Command | Description |
|---|---|
phpvm install [version] |
Install a PHP version (reads .phpvmrc or composer.json if omitted) |
phpvm use [version] |
Switch PHP version (.phpvmrc โ composer.json โ default alias) |
phpvm uninstall <version> |
Remove a specific PHP version |
phpvm current |
Display the currently active PHP version |
phpvm which [version] |
Show the path to PHP binary for a version |
phpvm exec [version] <command> [args...] |
Run a command with a PHP version (defaults to the project pin) |
phpvm run [version] [script] [args...] |
Run a PHP script with a PHP version (defaults to the project pin) |
phpvm deactivate |
Temporarily disable phpvm and restore PATH |
phpvm unload |
Remove phpvm from the current shell session |
phpvm system |
Switch to system/Homebrew default PHP |
phpvm auto |
Auto-switch based on .phpvmrc file |
phpvm list [pattern] or phpvm ls |
List installed PHP versions, optionally filtered (8, 8.2, an alias) |
phpvm reinstall-extensions <from> [to] |
Install the extensions <from> loads into [to] (default: active) |
phpvm install <ver> --reinstall-extensions-from=<from> |
Install a version, then its extensions from <from> |
phpvm ls-remote [pattern] |
List available remote PHP versions |
phpvm install latest-remote |
Install the latest remote PHP version available |
phpvm self-update [--force] |
Update phpvm to the latest stable release (checksum-verified) |
phpvm resolve [version|alias] |
Resolve a version descriptor (or the project pin) to an installed version |
phpvm alias [name] [ver] |
Create, update, or list version aliases |
phpvm unalias <name> |
Remove version alias |
phpvm cache <dir|clear> |
Show or clear the phpvm cache directory |
phpvm info |
Show system information for debugging |
phpvm version |
Show version information |
phpvm --version / -v |
Show version information (aliases) |
phpvm help |
Show help message |
To install a specific version of PHP:
phpvm install 8.1
Smart Repository Detection: On RHEL/Fedora systems, phpvm automatically detects if PHP packages are available in your current repositories. If not, it provides step-by-step instructions to enable the necessary repositories (like Remi's repository) before installation.
To switch between installed versions:
phpvm use 8.0
To switch back to the system PHP version (Homebrew default on macOS):
phpvm system
Verify the active version with:
php -v
By default, phpvm use switches PHP through Homebrew links or Linux alternatives, which affects every shell using those system paths. To select a version independently in each Bash or Zsh shell, set session mode before sourcing phpvm:
export PHPVM_SWITCH_MODE=session
source "$PHPVM_DIR/phpvm.sh"
phpvm use 8.2
php -v
Each shell can then select a different installed PHP version. phpvm use system removes phpvm's session path entry and uses the first system PHP found on the remaining PATH; phpvm deactivate clears the selection while preserving other PATH edits. phpvm current, phpvm which, and phpvm list report the calling shell's selection. In this mode, run switching commands through the sourced phpvm function. The standalone script rejects use, system, and auto because a child process cannot change its parent shell.
Session mode manages the PHP CLI binary used by php, PHP scripts, and commands such as php composer.phar. It does not switch phpize, php-config, FPM, web-server settings, or hard-coded interpreter paths. Package installation and removal still use the detected system package manager. Updates or removals made outside phpvm can affect shells using that PHP installation.
To see which PHP version is currently active:
phpvm current
This will display the active PHP version, "system" (if using system PHP), or "none" (if no PHP is active).
To find the path to a PHP binary for any version:
# Show path for a specific version
phpvm which 8.2
# Show path for current version
phpvm which
This works across all package managers (Homebrew, apt, dnf, yum, pacman) and is useful for IDE configuration or scripting.
To temporarily disable phpvm and restore your original PATH:
phpvm deactivate
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.
To check the phpvm version and get information:
phpvm version
# or
phpvm --version
# or
phpvm -v
Create a .phpvmrc file in your project directory to specify the desired PHP version:
echo "8.1" > .phpvmrc
Automatic switching on cd: When phpvm is sourced into your shell, it registers a cd hook that detects .phpvmrc files and switches PHP versions automatically as you navigate between directories. No manual command needed โ just cd into a project.
PROMPT_COMMANDchpwd_functionsPHPVM_AUTO_USE=true (the default)Using use and install without a version: When no version argument is given, these commands read .phpvmrc automatically:
# Reads version from .phpvmrc in current or parent directories
phpvm use
phpvm install
phpvm use follows this fallback chain: .phpvmrc โ composer.json PHP requirement โ default alias โ error.
Manual switching: You can also trigger auto-switching explicitly:
phpvm auto
Aliases can also be used in .phpvmrc:
echo "default" > .phpvmrc
phpvm auto
Most PHP projects already declare their PHP version in composer.json, so a .phpvmrc is optional. When no version is given, phpvm use, phpvm install, and phpvm resolve read the nearest project pin:
.phpvmrc first, then for a PHP requirement in composer.json. The closest directory wins.composer.json, config.platform.php (the exact deployment target) takes precedence over require.php. A composer.json without a PHP requirement is skipped.use and resolve select the newest installed version that satisfies it; install selects the newest version available from your package manager.{
"require": {
"php": "^8.1 <8.4"
}
}
$ phpvm use
Found PHP requirement '^8.1 <8.4' in composer.json; using 8.3
Switching to PHP 8.3...
Switched to PHP 8.3.
$ phpvm resolve
8.3
Supported constraint syntax: ^8.1, ~8.2, ~8.2.0, >=8.1, >8.1, <=8.3, <8.4, 8.2.*, 8.1 - 8.3, exact versions such as 8.2.12, AND (space or comma) and OR (||). != clauses and stability flags such as @dev are ignored. A version matches when any of its patch releases would satisfy the constraint.
If no installed version matches, phpvm use exits with code 4; if no available version matches, phpvm install exits with code 3. Requirements that use unsupported characters are ignored with a warning, and phpvm use falls back to the default alias.
By default, automatic switching on cd, at shell startup, and with phpvm auto reads .phpvmrc only, so Composer projects don't switch PHP unexpectedly. To switch automatically on composer.json requirements as well, opt in before sourcing phpvm:
export PHPVM_AUTO_USE_COMPOSER=true
Automatic switching then uses the same nearest-pin rules as phpvm use and selects the newest installed version that satisfies the requirement.
To list all installed PHP versions:
phpvm list
The active version is marked with -> and highlighted in green. If a default alias is set, it is annotated inline:
Installed PHP versions:
-> 8.2 (default)
8.1
8.0
system
Active version: 8.2
Pass a pattern to filter the list, like nvm ls <version>. Patterns match whole version components, so 8.2 does not match 8.20. Aliases filter by the version they point to, and system shows only the system entry:
phpvm ls 8 # every installed 8.x version
phpvm ls 8.2 # just 8.2
phpvm ls default # the version the default alias points to
If nothing matches, phpvm ls exits with code 3.
When you move to a new PHP version, phpvm can install the extensions your current version uses, like nvm's --reinstall-packages-from:
# Install PHP 8.4, then the extensions PHP 8.3 loads that 8.4 lacks
phpvm install 8.4 --reinstall-extensions-from=8.3
# Same for versions that are already installed (target defaults to the active version)
phpvm reinstall-extensions 8.3 8.4
On Homebrew, extensions already built for the target PHP are enabled without rebuilding. Re-running the command can restore missing extension loaders.
phpvm compares php -m for both versions to find the missing extensions, then installs them:
phpX.Y-<extension> packages, mapping extensions that share a package (for example pdo_mysql and mysqli โ phpX.Y-mysql). Extensions without a package are listed for manual installation, and the command exits with code 3.pecl.Create or update a version alias:
phpvm alias default 8.2
phpvm alias production 8.1
List aliases:
phpvm alias
List aliases matching a pattern:
phpvm alias def
Remove an alias:
phpvm unalias production
Aliases also appear in phpvm list output when defined.
You can also use latest or stable as shorthand for the latest installed PHP version:
phpvm use latest
phpvm use stable
Show the phpvm cache directory:
phpvm cache dir
Clear all cached files:
phpvm cache clear
Show system details for debugging:
phpvm info
This displays OS type, architecture, package manager, installed PHP versions, and other diagnostic information useful for bug reports.
To remove a specific PHP version:
phpvm uninstall 7.4
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:
# Run composer install with PHP 8.2
phpvm exec 8.2 composer install
# Run a linter with PHP 8.1
phpvm exec 8.1 ./vendor/bin/phpstan analyse
Use phpvm run as a shortcut for phpvm exec <version> php:
# Run a PHP script with PHP 8.1
phpvm run 8.1 script.php arg1 arg2
# Equivalent to:
phpvm exec 8.1 php script.php arg1 arg2
Both commands resolve aliases and keywords (default, latest, stable) before execution.
When the first argument is not a version, keyword, or alias, both commands use the project pin (.phpvmrc or composer.json), like nvm exec and nvm run. The message naming the pin goes to stderr, so the command's output stays clean:
# Inside a project that requires "php": "^8.2"
phpvm exec composer install
phpvm run script.php
List PHP versions available for installation from your system package manager:
phpvm ls-remote
Filter by pattern:
phpvm ls-remote 8.2
Supported package managers: Homebrew, apt, dnf, yum, and pacman.
Resolve a version descriptor, alias, or keyword to a locally installed version number:
# Resolve an alias
phpvm resolve default # โ 8.2
# Resolve a keyword
phpvm resolve latest # โ 8.3
# Pass through a concrete version (if installed)
phpvm resolve 8.1 # โ 8.1
# Resolve the current project's pin (.phpvmrc or composer.json)
phpvm resolve # โ 8.3
This is useful in CI scripts or tooling that needs to know which version an alias points to.
Remove phpvm from the current shell session entirely:
phpvm unload
This deactivates phpvm, removes the cd hook, and unsets all phpvm functions and variables. To use phpvm again, re-source it:
source ~/.phpvm/phpvm.sh
phpvm includes tab completion for Bash and Zsh that is automatically loaded when phpvm is sourced. It provides context-aware completions for:
use, uninstall, which, exec, run, resolve, ls, reinstall-extensions, and --reinstall-extensions-from)unalias)install --reinstall-extensions-from, self-update --force) and cache subcommands (dir, clear)Completions are loaded from $PHPVM_DIR/completions/phpvm.bash. Bash needs no setup. In Zsh, phpvm registers completion through bashcompinit, as nvm does. This needs Zsh's completion system to be loaded before phpvm is sourced; frameworks such as Oh My Zsh already do this. Otherwise add this above the phpvm lines in ~/.zshrc:
autoload -Uz compinit && compinit
--no-useLoad phpvm functions without triggering auto-switch or registering the cd hook:
source ~/.phpvm/phpvm.sh --no-use
This is useful for lazy-loading setups where you want phpvm functions available but don't want automatic version switching on shell startup.
phpvm uses specific exit codes for better scripting support:
| Exit Code | Meaning |
|---|---|
0 |
Success |
1 |
General error |
2 |
Invalid argument or usage error |
3 |
Version not found (not available) |
4 |
Version not installed locally |
5 |
File or permission error |
127 |
Unknown command |
Example usage in scripts:
phpvm use 8.2
if [ $? -eq 0 ]; then
echo "Successfully switched to PHP 8.2"
else
echo "Failed to switch PHP version"
fi
| Variable | Default | Description |
|---|---|---|
PHPVM_DIR |
~/.phpvm |
Installation directory (falls back to $XDG_CONFIG_HOME/phpvm if XDG_CONFIG_HOME set) |
PHPVM_SWITCH_MODE |
global |
Set to session before sourcing to switch PHP independently in each shell |
PHPVM_BIN |
(export) | Active PHP binary directory (set after version switch, unset on deactivate) |
PHPVM_AUTO_USE |
true |
Enable automatic .phpvmrc detection when sourced |
PHPVM_PHPVMRC_MAX_DEPTH |
25 |
Max parent directories to traverse when searching for .phpvmrc |
PHPVM_APT_INSTALL_FPM |
false |
On apt systems, also install phpX.Y-fpm (which starts a php-fpm service) |
PHPVM_AUTO_USE_COMPOSER |
false |
Let automatic switching (startup, cd, phpvm auto) also use composer.json |
PHPVM_DEBUG |
false |
Enable debug logging with timestamps |
NO_COLOR |
(unset) | Disable color output (no-color.org) |
PHPVM_LOG_TIMESTAMPS |
false |
Always show timestamps in log output |
To completely remove phpvm, run:
rm -rf ~/.phpvm
Then remove the following lines from your shell profile (~/.bashrc, ~/.zshrc, or ~/.profile):
export PHPVM_DIR="$HOME/.phpvm"
export PATH="$PHPVM_DIR/bin:$PATH"
[ -s "$PHPVM_DIR/phpvm.sh" ] && . "$PHPVM_DIR/phpvm.sh"
If you experience issues with phpvm, try the following:
bats tests/ to verify all functions are working correctlyphpvm version or phpvm --versionphpvm.shsudo for installation and switchingbrew unlink php@X.Y && brew link --force php@X.YIf you encounter "PHP packages not found" errors on RHEL-family distributions, phpvm will automatically provide setup instructions. You can also manually enable the required repositories:
# Install Remi's repository
sudo dnf install https://rpms.remirepo.net/fedora/remi-release-$(rpm -E %fedora).rpm
# Enable the repository
sudo dnf config-manager --set-enabled remi
# Enable specific PHP version (example for PHP 8.3)
sudo dnf config-manager --set-enabled remi-php83
# Install EPEL repository
sudo dnf install epel-release
# Install Remi's repository
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-$(rpm -E %rhel).rpm
# Enable the repositories
sudo dnf config-manager --set-enabled remi
sudo dnf config-manager --set-enabled remi-php83 # for PHP 8.3
If you prefer to avoid repository management, you can install Homebrew on Linux:
# Install Homebrew on Linux
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add to your shell profile
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc
source ~/.bashrc
# Now phpvm will use Homebrew instead of dnf/yum
phpvm install 8.3
phpvm features comprehensive testing using the BATS (Bash Automated Testing System) framework. The project includes extensive GitHub Actions workflows that test every aspect of the script.
Run the BATS test suite to validate all functionality:
# Run all tests
make test-bats
# Or run BATS directly
bats tests/
# Run specific test file
bats tests/01_core.bats
The BATS test suite verifies:
The project features a streamlined CI/CD pipeline with comprehensive testing in a single consolidated workflow:
.github/workflows/ci.yml)Consolidated testing workflow including:
.github/workflows/release.yml)Release-specific workflow including:
The testing suite covers:
# Syntax check
bash -n phpvm.sh
# Run all BATS tests
bats tests/
# Run specific test file
bats tests/01_core.bats
# Test input validation
./phpvm.sh install "invalid..version" # Should fail gracefully
# Test system information
./phpvm.sh info
# Test with debug output
PHPVM_DEBUG=true ./phpvm.sh version
To enable debug output, set the PHPVM_DEBUG environment variable to true:
PHPVM_DEBUG=true phpvm install 8.1
phpvm is maintained by Jerome Thayananthajothy.
This project is licensed under the MIT License. See LICENSE for details.
phpvm is provided as-is without any warranties. Use it at your own risk.
Thavarshan/phpvm is a public repo on GitHub by Thavarshan. ๐ Simple PHP version manager for MacOS and Linux.
It declares the MIT license on GitHub.
Its maker tagged it for macOS and Linux. That is declared by the maker; Take My Repo has not tested it.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-10-29. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Laravel is a web application framework with expressive, elegant syntax. Weโve already laid the foundation for your next big idea โ freeing you to create without sweating the small things.
Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions.

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
๐ Modern PHP HTTP client inspired by JavaScript's fetch API. Async/await, streaming, SSE, middleware, RFC 7234 caching, and full PSR-7/18 compliance.
๐ Enhance Laravel queries with adaptable, customisable filters and intelligent caching to improve both performance and functionality.
Honeymelon - free, open-source desktop media conversion for video, audio and images. Local processing, no account or uploads.
Event-driven async helpers for ReactPHP with promise composition, cancellation, timeouts, concurrency limits, and rate limiting.
๐ Wisp is a simple and secure platform for sharing encrypted, one-time secrets via protected links that automatically expire.
โ๏ธโ๐ฅ The source code of Formlink. A Fullstack TypeScript form handler library.
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/Thavarshan/phpvmTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.