Simple and powerful PHP version manager for Linux and macOS. Install, switch, and manage multiple PHP versions effortlessly.
curl -o install.sh https://raw.githubusercontent.com/kunalGhoshOne/pvm/development/install.sh && chmod +x install.sh && ./install.shcurl -o ~/.pvm.sh https://[save-the-artifact-content]
**For Zsh:**
```bash
echo 'source ~/.pvm.sh' >> ~/.zshrc
source ~/.zshrc
source ~/.pvm.sh
That's it! PVM will automatically install dependencies when needed.
---
## 📖 Usage
### Install PHP Version
```bash
pvm install 8.3.0
source ~/.bashrc # or source ~/.zshrc
### List Installed Versions
```bash
pvm list
sudo apt-get install build-essential libxml2-dev libssl-dev
libcurl4-openssl-dev libzip-dev pkg-config
### Show Current Version
```bash
pvm current
brew install openssl curl zlib pkg-config
### Execute with Specific Version
```bash
pvm exec 8.2.0 script.php
pvm install 8.3.0 # Install PHP 8.3.0 pvm use 8.3.0 # Switch to it php -v # Verify
Create a .phpversion file in your project:
echo "8.3.0" > .phpversionPVM will automatically switch to this version when you cd into the directory.
pvm reinstall-depspvm which 8.3.0pvm help# Install PHP 8.3.0
pvm install 8.3.0
# Switch to it
pvm use 8.3.0
# Verify
php -v
# Set as default
pvm alias default 8.3.0
# Install another version
pvm install 8.2.15
pvm use 8.2.15
# List all installed versions
pvm listPVM automatically installs these dependencies based on your OS:
- Build tools (gcc, make, autoconf)
- Required libraries (openssl, curl, libzip, libxml2)
- Development headers
- PHP compilation tools
Note: You may be prompted for your sudo password during first installation.
Remove PVM and all installed PHP versions:
rm -rf ~/.pvmRemove from shell profile:
# Remove this line from ~/.bashrc or ~/.zshrc
source ~/.pvm.sh- Use
pvm list-remoteto see all available PHP versions - Create a
.phpversionfile for automatic version switching - Use aliases for quick switching:
pvm alias prod 8.3.0 - Compilation takes 5-15 minutes depending on your system
Dependencies failed to install:
pvm reinstall-depsCompilation failed:
- Check error messages for missing libraries
- Run
pvm reinstall-depsand try again
Version not switching:
source ~/.bashrc # or source ~/.zshrc
pvm use 8.3.0MIT License - Feel free to use and modify!