Wrapper scripts for managing multiple PHP and Node.js versions automatically based on project configuration files.
- Fedora (using Remi repository)
- Ubuntu/Debian (using Ondřej Surý PPA)
- macOS (using Homebrew)
| Script | Description |
|---|---|
php |
Automatically selects PHP version based on .php-version or composer.json |
php-ext |
Installs PHP extensions for all installed PHP versions |
node |
Automatically selects Node.js version based on .nvmrc or package.json (volta) |
npm |
NPM wrapper using the node script for version management |
npx |
NPX wrapper using the node script for version management |
composer |
Composer wrapper with automatic PHP version selection |
Fedora:
sudo dnf install -y git curlUbuntu/Debian:
sudo apt-get install -y git curlmacOS:
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install git (curl is included with macOS)
brew install gitOther dependencies (jq, PHP repositories, fnm) are installed automatically by the scripts when needed.
git clone https://github.com/liamdemafelix/devwrappers.git ~/.local/share/dev-scriptsAdd to your shell configuration (~/.bashrc or ~/.zshrc):
export PATH="$HOME/.local/share/dev-scripts:$PATH"Reload your shell:
source ~/.bashrc # or source ~/.zshrcThe php script automatically detects the required PHP version from:
.php-versionfile (e.g.,8.2)composer.jsonrequire.phpconstraint (e.g.,^8.1,>=7.4)
If no version is specified, it uses the latest installed version.
# Run PHP with auto-detected version
php script.php
# PHP will auto-install missing versions
echo "8.3" > .php-version
php -v # Installs and uses PHP 8.3Install extensions across all PHP versions:
php-ext curl mbstring xml
# Sync saved extensions to all versions
php-ext --syncExtensions are saved to ~/.config/php/extensions for automatic installation with new PHP versions.
Note for macOS: Extensions are installed via PECL instead of package manager. Most common extensions (curl, mbstring, etc.) are already bundled with Homebrew PHP.
The node script uses fnm as the backend and detects versions from:
.nvmrcfilepackage.jsonvolta.nodefield
Supported version formats: lts/*, lts/iron, lts, node, 20, 20.10, 20.10.0
# Run Node with auto-detected version
node app.js
# Use LTS by default when no version specified
node -vThe composer script automatically:
- Selects the PHP version based on project requirements
- Uses Composer LTS (2.2.x) for PHP < 7.2, latest otherwise
composer install
composer require some/packagePlace custom .ini files in ~/.config/php/conf.d/ to apply settings across all PHP versions.
| Item | Location |
|---|---|
| PHP extensions list | ~/.config/php/extensions |
| PHP custom config | ~/.config/php/conf.d/ |
| Composer phars | ~/.local/share/composer/ |
| fnm installation | ~/.local/share/fnm/ |
0BSD - See LICENSE.md