# phpv

**The PHP version manager that actually compiles · Go**

phpv is a PHP version manager written in Go that 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.

- **Status:** v0.14.1
- **License:** MIT
- **Repository:** <https://github.com/supanadit/phpv>

## What it does

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.

## The problem

PHP is the only major language without prebuilt Linux binaries. Node, Python, Ruby, Go — all ship official binaries. PHP expects you to compile. Compiling PHP by hand means hunting down OpenSSL, libxml2, curl, zlib, oniguruma and ICU. Getting the --with-* flags right for your extensions is a black art. Version managers like phpenv and phpbrew punt: they assume the deps are already there. phpv makes the whole thing deterministic — and it actually works.

## Features

- **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.
- **Reuse what you have** — System packages that satisfy the required version constraints are used directly — no source download, no rebuild. Only what is actually missing gets compiled.
- **Correct --with-* flags** — Compiles PHP with the right configure flags for your extension list. 25 default extensions work out of the box.
- **Ephemeral per-shell use** — 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.
- **Per-project .php-version** — Drop a .php-version file in a repo and phpv auto-switches on cd. No more remembering which PHP a project needs.
- **Per-version isolation** — Each PHP version gets its own install prefix and phar directory. No conflicts between versions, ever.
- **Extension management** — phpv extension add/remove/list with --auto-deps, --dry-run and --no-system. Recommends distro-specific dev libraries before building.
- **PHAR & PECL tools** — phpv phar install composer|pie|wp-cli|phpunit per version, and phpv pecl install/list/uninstall. Each PHP version keeps its own tools.
- **Portable bundles** — phpv share 8.4 exports a portable tar.gz; phpv install 8.4 --from bundle.tar.gz imports it. Move builds between machines.
- **phpv doctor** — System readiness check plus extension analysis. Reports missing dev-libraries with distro-specific install commands.
- **PHP 5.x → 8.x support** — From PHP 5.0 (experimental) through 8.x, with per-version default extension sets. Auto-bundles OpenSSL 1.1.1w for 7.4.
- **Parallel, visible builds** — phpv install 8.4 --jobs 4 for parallel make. Per-package download progress with completion counts — no frozen spinners.

## How it works

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.

