Transitive dependency graph
Resolves the full graph — OpenSSL, libxml2, curl, zlib, oniguruma, ICU — per extension per PHP version. Deterministic resolution for 7.x/8.0/8.1/8.2+ alike.
phpv · v0.14.1 · MIT · linux · darwin
Every other major language ships prebuilt binaries. PHP does not. phpv resolves the full transitive dependency graph, reuses what your system already has, builds the rest from source, and compiles PHP with the correct --with-* flags. phpv install 8.4 actually works.
curl -fsSL https://raw.githubusercontent.com/supanadit/phpv/main/install.sh | bash
phpv makes the whole thing deterministic — and it actually works.
Resolves the full graph — OpenSSL, libxml2, curl, zlib, oniguruma, ICU — per extension per PHP version. Deterministic resolution for 7.x/8.0/8.1/8.2+ alike.
System packages that satisfy the required version constraints are used directly — no source download, no rebuild. Only what is actually missing gets compiled.
Compiles PHP with the right configure flags for your extension list. 25 default extensions work out of the box.
phpv use 8.3 in terminal A and phpv use 8.4 in terminal B — each shell gets its own version without touching the global default. Requires phpv init.
Drop a .php-version file in a repo and phpv auto-switches on cd. No more remembering which PHP a project needs.
Each PHP version gets its own install prefix and phar directory. No conflicts between versions, ever.
phpv extension add/remove/list with --auto-deps, --dry-run and --no-system. Recommends distro-specific dev libraries before building.
phpv phar install composer|pie|wp-cli|phpunit per version, and phpv pecl install/list/uninstall. Each PHP version keeps its own tools.
phpv share 8.4 exports a portable tar.gz; phpv install 8.4 --from bundle.tar.gz imports it. Move builds between machines.
System readiness check plus extension analysis. Reports missing dev-libraries with distro-specific install commands.
From PHP 5.0 (experimental) through 8.x, with per-version default extension sets. Auto-bundles OpenSSL 1.1.1w for 7.4.
phpv install 8.4 --jobs 4 for parallel make. Per-package download progress with completion counts — no frozen spinners.
# Install PHP 8.4 — 25 default extensions, deps auto-resolved,
# built from source if needed.
phpv install 8.4
# Customize the extension list
phpv install 8.4 --ext openssl,curl,apcu
phpv install 8.4 --minimal # bare build (--disable-all --enable-cli)
phpv install 8.4 --jobs 4 # parallel make
phpv install 8.4 --fresh # clean rebuild, keep cached source
# Initialize your shell (add to ~/.bashrc, ~/.zshrc, or fish config)
eval "$(phpv init bash)"
# Switch versions — per-shell, ephemeral
phpv use 8.3 # current shell only
phpv use system # stop pinning, fall back to default
phpv use 8.3 --global # global default
phpv default 8.3 # set global default
phpv versions # list installed
phpv which # path to current PHP
# Per-project version via .php-version — auto-switch on cd
echo "7.2" > .php-version
# Now every shell that enters this directory uses PHP 7.2
# (requires `phpv init` in your shell config)
# List what's available / installed
phpv extension list
phpv extension available 8.4
# Add an extension into the active version
phpv extension add pdo_pgsql
# → recommends installing postgresql-libs (Arch) /
# libpq-dev (Debian/Alpine) / postgresql-devel (Fedora)
phpv extension add redis --auto-deps --dry-run
phpv extension remove xdebug
# Manage PHAR tools — per-version, each PHP has its own phars
phpv phar install composer
phpv phar install pie
phpv phar install wp-cli
phpv phar install composer --version 8.4
phpv phar update composer
phpv phar list
phpv phar which composer
# Export a PHP build as a portable bundle
phpv share 8.4 # → bundle.tar.gz
# Import it on another machine
phpv install 8.4 --from bundle.tar.gz
# System readiness check
phpv doctor
# Extension analysis for a specific version
phpv doctor 8.4
# Full verbose rebuild when something's off
phpv install 8.4 --fresh --verbose
phpv turns "compile PHP from source" into a single deterministic command. It resolves the dependency graph, reuses what your system already has, builds only what is missing, and compiles PHP with the correct flags.
Dependencies are keyed by (name, version) and shared across PHP versions that pin the same version — build once, reuse everywhere. phpv only downloads and extracts what it will actually compile; system packages that satisfy the required version constraints are used directly, and build tools come from the system.
The full phpv command surface, grouped by workflow. Every command is a single binary — no runtime dependencies.
phpv install <ver>
Install a PHP version with default extensions
phpv rebuild <ver>
Rebuild PHP with different extensions (keeps deps)
phpv uninstall <ver>
Remove an installed PHP version
phpv share <ver>
Export PHP as a portable bundle
phpv use <ver>
Switch for current shell (ephemeral; --global for global)
phpv default <ver>
Set global default PHP version
phpv versions
List installed PHP versions
phpv which
Show path to current PHP binary
phpv extension list [ver]
List installed extensions
phpv extension available [ver]
List extensions available for a version
phpv extension add <name>…
Install extensions into the active version
phpv extension remove <name>…
Remove extensions from the active version
phpv phar install <name> [ver]
Install a PHAR tool (composer/pie/wp-cli/phpunit)
phpv phar update <name> [ver]
Update a PHAR tool
phpv pecl install <name|archive> [ver]
Install a PECL extension
phpv pecl uninstall <name> [ver]
Remove a PECL extension
phpv init <shell>
Generate shell integration (bash/zsh/fish/pwsh/ksh)
phpv doctor [ver]
System readiness check + extension analysis
phpv update
Self-update phpv
phpv completion <shell>
Generate shell completion
The recommended path is the one-line installer: it detects your platform and shell, installs to $PHPV_ROOT/bin (default ~/.phpv), and wires up shell integration automatically. Prebuilt binaries and building from source are also supported.
curl -fsSL https://raw.githubusercontent.com/supanadit/phpv/main/install.sh | bash
git clone https://github.com/supanadit/phpv.git && cd phpv && go build -o phpv ./app/phpv.go
The installer detects your platform and shell, installs to $PHPV_ROOT/bin (default ~/.phpv), and appends the phpv init line to your shell config automatically. Pin a version with INSTALL_VERSION=0.11.0. Prefer a manual install? Grab a binary from the releases page — each ships with a matching .sha256 file.
# The installer adds `eval "$(phpv init <shell>)"` to your shell config
# automatically. Restart your shell (or source the config), then:
phpv which # path to the current PHP binary
phpv versions # list installed PHP versions
phpv install 8.4 # 25 default extensions, deps auto-resolved
phpv use 8.4 --global
phpv is a PHP version manager written in Go. It resolves the full transitive dependency graph — OpenSSL, libxml2, curl, zlib, oniguruma, ICU — checks what is already on your system, builds what is missing from source, then compiles PHP with the correct --with-* flags. phpv install 8.4 actually works.
Because PHP has no prebuilt Linux binaries. Every other major language ships them; PHP does not. phpv makes compiling deterministic: it reuses system packages that satisfy the version constraints, builds only what is missing, and compiles with the right flags.
No. Each PHP version gets its own isolated install prefix under $PHPV_ROOT (default ~/.phpv). phpv use switches the current shell only — it never touches the global default unless you pass --global.
phpv init generates shell integration for bash, zsh, fish, pwsh and ksh. The ephemeral per-shell use switching works across all of them.
The installer puts the binary at $PHPV_ROOT/bin/phpv (default ~/.phpv/bin) — no sudo, no /usr/local/bin. Each PHP version gets its own isolated prefix under the same root, and the installer appends the phpv init line to your shell config automatically.
Yes. Set INSTALL_VERSION before running the installer, e.g. INSTALL_VERSION=0.11.0 curl -fsSL https://raw.githubusercontent.com/supanadit/phpv/main/install.sh | bash. Otherwise the latest release is detected automatically.
MIT. The current release is v0.14.1; install with the one-liner, download a binary from the GitHub releases page, or build from source.
One binary. Full dependency resolution. Compiles from source. phpv install 8.4 actually works.
Get started →