Supan Adit Pratama Back to projects
Personal Project

phpv

Open Source / Personal Active
phpv — Personal Project

phpv is a PHP version manager written in Go that actually compiles PHP from source — and makes it work. It resolves the full transitive dependency graph of OpenSSL, libxml2, curl, zlib, oniguruma, ICU, and more, detects what is already on your system, builds only what is missing, then compiles PHP with the correct --with-* flags.

The Problem

PHP has no pre-built Linux binaries. Every other major language — Node.js, Python, Go, Rust — distributes pre-compiled binaries for every platform. PHP does not. To install a specific PHP version on Linux you either rely on third-party PPAs that may not have the version you need, or you compile from source — which means manually resolving OpenSSL, libxml2, curl, zlib, oniguruma, ICU, and a dozen other dependencies, each with their own version constraints. Existing tools like phpenv and php-build exist, but they do not resolve transitive dependencies, do not detect system libraries, and fail on missing deps with cryptic configure errors.

The Solution

phpv resolves the full transitive dependency graph, checks what is already on your system via pkg-config and header probes, builds only what is missing from source, then compiles PHP with the correct --with-* flags. It supports PHP 4.x through 8.x side by side, with parallel dependency builds, per-version extension, PHAR, and PECL management, ephemeral per-shell version switching, per-project .php-version auto-switching, portable bundle export/import, and a doctor command that diagnoses system readiness. It ships as a single binary with no runtime dependencies.

Key Features

  • Go Language
  • PHP Version Manager
  • Source Compilation
  • Transitive Dependency Resolution
  • System Library Detection
  • Parallel Builds
  • Multi-Version Support
  • Extension Management
  • PECL Management
  • PHAR Management
  • Ephemeral Per-Shell Switching
  • Per-Project .php-version
  • Portable Bundles
  • Single Binary

Key Outcomes

Full Dep Resolution

Resolves the entire transitive dependency graph — OpenSSL, libxml2, curl, ICU, and more — automatically.

Source Compilation

Actually compiles PHP from source with correct --with-* flags — no PPAs, no pre-built binaries needed.

System Lib Detection

Detects installed dev packages via pkg-config and header checks — uses system libs when available.

Parallel Builds

Dependencies at the same graph level compile concurrently — dramatically faster installs.

Ephemeral Switching

Per-shell version switching that never touches the global default — plus per-project .php-version auto-switching.

Portable Bundles

Export any PHP build as a portable bundle and reinstall it elsewhere with a single command.

Single Binary

Written in Go — one binary, zero runtime dependencies. PHP 4.x through 8.x side by side.

Project Summary

phpv solves a problem that should not exist in 2025: PHP has no pre-built Linux binaries. Written in Go, it resolves the full transitive dependency graph, detects what is already on your system, builds what is missing from source, and compiles PHP with the correct configure flags. Available at github.com/supanadit/phpv.