phpenv
manages multiple PHP versions per-project
TLDR
List installed PHP versions
SYNOPSIS
phpenv [install] [global] [local] [shell] [versions] [options] [version]
DESCRIPTION
phpenv manages multiple PHP versions per-project. It uses shims to intercept PHP commands and route them to the correct version.
Version selection follows a hierarchy: PHPENV_VERSION environment variable, .php-version file in current/parent directories, global version setting.
The local command creates a .php-version file in the current directory. When entering that directory, phpenv automatically uses the specified version.
Installation requires php-build plugin, which compiles PHP from source. Build dependencies must be installed first.
After installing PHP extensions or PEAR packages, run rehash to create shims for new executables.
The architecture mirrors rbenv for Ruby, providing familiar version management for polyglot developers.
PARAMETERS
install VERSION
Install PHP version.install --list
List available versions.versions
List installed versions.version
Show current version.global [VERSION]
Set/show global version.local [VERSION]
Set/show local version.shell [VERSION]
Set shell-specific version.rehash
Rebuild shim executables.which CMD
Show path for command.root
Show phpenv root.
CAVEATS
Compiling PHP requires build dependencies. Build times can be significant. Shell initialization required. Some extensions may need manual configuration.
HISTORY
phpenv was modeled after rbenv to provide similar version management for PHP. It uses the same shim-based approach and plugin architecture, making PHP version management consistent with other language environments.
