Skip to content

vunf1/php-version-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PHP Version Manager

A modern, cross-platform PHP version manager with an intuitive graphical interface

License: MIT Platform

Built with Rust for memory safety, performance, and low resource usage


🌟 Overview

PHP Version Manager (phpvm) is a cross-platform tool that simplifies managing multiple PHP versions on your system. Whether you're a developer switching between PHP versions for different projects or a system administrator managing PHP installations, phpvm provides a modern, user-friendly solution.

Key Highlights

  • 🎨 Modern GUI: Clean, intuitive interface built with Tauri and React
  • ⚑ Fast & Lightweight: Native performance with minimal resource footprint
  • πŸ”’ Memory Safe: Built with Rust for security and reliability
  • 🌍 Cross-Platform: Works seamlessly on Windows and Linux
  • πŸ”„ Automatic PATH Management: Seamless version switching with automatic system PATH updates
  • πŸ“¦ Smart Caching: Efficient download caching with checksum verification
  • πŸ” Secure: Atomic operations with rollback support and checksum verification

✨ Features

Core Functionality

  • πŸ“₯ Install PHP Versions: Download and install multiple PHP versions from official sources
  • πŸ”„ Version Switching: Easily switch between installed PHP versions with a single click
  • πŸ—‘οΈ Version Management: Remove unused versions to free up disk space
  • πŸ‘€ Version Discovery: Browse available PHP versions across different releases
  • πŸ“Š Version Status: View detailed information about installed and active versions

User Interface

  • πŸ“‘ Tabbed Interface: Organized views for Installed Versions, Available Versions, Cache, and Settings
  • πŸ“ˆ Progress Tracking: Real-time progress indicators for downloads and installations
  • πŸ”” Notifications: Clear feedback for all operations, successes, and errors
  • 🎨 Modern Design: Clean, responsive interface with smooth animations

Platform Features

  • πŸ’Ύ Cache Management: View and manage downloaded PHP archives with efficient caching
  • πŸ”§ Settings: Configure installation paths, cache location, and update preferences
  • πŸ”„ Auto-Updates: Automatic update checking and one-click updates (when available)
  • πŸ” Thread-Safe Variants: Support for both Thread-Safe (TS) and Non-Thread-Safe (NTS) PHP builds on Windows

Security & Reliability

  • βœ… Checksum Verification: All downloads are verified for integrity
  • πŸ”„ Atomic Operations: Installations are atomic with rollback support
  • πŸ‘€ User-Scoped: No silent privilege escalation required
  • πŸ›‘οΈ Memory Safe: Built with Rust for enhanced security

πŸ“¦ Installation

Pre-built Packages

Windows (64-bit)

Two installer options are available from the Releases page:

  • MSI Installer (*.msi)

    • Recommended for enterprise deployments
    • Supports silent installation
    • Integrates with Windows Installer service
  • Setup Executable (*-setup.exe)

    • User-friendly installation wizard
    • Includes automatic dependency checks
    • Standard Windows installer experience

Linux

  • AppImage: Download the .AppImage file, make it executable (chmod +x), and run it
  • Debian/Ubuntu: Install the .deb package with sudo dpkg -i *.deb
  • Fedora/RHEL: Install the .rpm package with sudo rpm -i *.rpm or sudo dnf install *.rpm

Build from Source

Prerequisites

Required:

  • Rust (Cargo) - Latest stable version (Install Rust)
  • Node.js and npm - Version 18+ (Install Node.js)
  • Platform-specific build tools:
    • Windows: Visual Studio Build Tools with C++ workload
    • Linux: Build essentials and WebKit/GTK development libraries

Quick Start

Windows (PowerShell):

# Development build (faster, opens automatically)
.\build-dev.ps1

# Production build
.\build.ps1

Windows (CMD):

build-dev.bat
build.bat

Linux/macOS:

# Development build
chmod +x build-dev.sh
./build-dev.sh

# Production build
chmod +x build.sh
./build.sh

Manual Build

  1. Build Core Library:

    cd phpvm-core
    cargo build --release
  2. Build GUI:

    cd phpvm-gui
    npm install
    npm run tauri build
  3. Run Application:

    • Windows: phpvm-gui\src-tauri\target\release\phpvm-gui.exe
    • Linux: phpvm-gui/src-tauri/target/release/phpvm-gui
    • macOS: phpvm-gui/src-tauri/target/release/bundle/macos/PHP Version Manager.app

πŸš€ Getting Started

1. Install Your First PHP Version

  1. Launch PHP Version Manager
  2. Open the "Available Versions" tab
  3. Select a PHP version from the list
  4. Click "Install" and wait for the download and installation to complete

2. Switch PHP Versions

  1. Go to the "Installed Versions" tab
  2. Find your desired version in the list
  3. Click "Set Active" on the version you want to use
  4. The system PATH will be updated automatically

3. Manage Versions

  • Remove Versions: Click "Remove" on any installed version to delete it
  • View Cache: Check the "Cache" tab to see downloaded archives
  • Clear Cache: Remove cached downloads to free up disk space
  • Configure Settings: Adjust paths and preferences in the "Settings" tab

πŸ—οΈ Architecture

Project Structure

php-version-manager/
β”œβ”€β”€ phpvm-core/          # Core library (Rust)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config.rs    # Configuration management
β”‚   β”‚   β”œβ”€β”€ download.rs  # Download and caching
β”‚   β”‚   β”œβ”€β”€ install.rs   # Installation logic
β”‚   β”‚   β”œβ”€β”€ manager.rs   # Main PHP manager interface
β”‚   β”‚   β”œβ”€β”€ platform.rs  # OS-specific operations (PATH management)
β”‚   β”‚   β”œβ”€β”€ provider.rs  # PHP version provider/API
β”‚   β”‚   β”œβ”€β”€ state.rs     # State management
β”‚   β”‚   └── version.rs   # Version parsing and handling
β”‚   └── Cargo.toml
β”œβ”€β”€ phpvm-gui/           # Graphical user interface
β”‚   β”œβ”€β”€ src/             # React frontend
β”‚   β”‚   β”œβ”€β”€ components/  # UI components
β”‚   β”‚   β”œβ”€β”€ hooks/       # React hooks
β”‚   β”‚   β”œβ”€β”€ services/    # API services
β”‚   β”‚   └── styles/      # CSS stylesheets
β”‚   β”œβ”€β”€ src-tauri/       # Tauri backend (Rust)
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ commands.rs  # Tauri command handlers
β”‚   β”‚   β”‚   β”œβ”€β”€ main.rs      # Application entry point
β”‚   β”‚   β”‚   └── update.rs    # Auto-update functionality
β”‚   β”‚   └── tauri.conf.json
β”‚   └── package.json
β”œβ”€β”€ build.sh             # Build script (Linux/macOS)
β”œβ”€β”€ build.ps1            # Build script (Windows PowerShell)
└── build.bat            # Build script (Windows CMD)

Design Philosophy

The project uses a modular architecture with clear separation between core logic and user interface:

  • phpvm-core: Contains all business logic for managing PHP versions

    • Platform-independent core operations
    • Platform-specific implementations for Windows and Linux
    • No UI dependencies
  • phpvm-gui: Provides the graphical user interface

    • React frontend for UI rendering
    • Tauri backend that directly uses phpvm-core
    • Communication via Tauri commands

Benefits:

  • βœ… No code duplication: All PHP management logic is centralized
  • βœ… Maintainability: Changes to core logic are isolated
  • βœ… Testability: Core library can be tested independently
  • βœ… Future CLI: Core library can be reused for a future CLI tool

Core Components

PhpManager

Main interface for all PHP operations:

  • Install/remove PHP versions
  • Switch between versions
  • List installed and available versions
  • Manage cache

Installer

Handles the complete installation process:

  • Download verification
  • Archive extraction
  • File installation
  • PATH management

Downloader

Manages downloads with:

  • Efficient caching
  • Checksum verification
  • Progress reporting
  • Resume support

PhpState

Tracks application state:

  • Installed versions
  • Active version
  • Configuration settings

πŸ› οΈ System Requirements

Windows

  • OS: Windows 10 or later (64-bit)
  • Privileges: Administrator privileges for installation (optional for user-scoped installs)
  • Network: Internet connection for downloading PHP versions
  • Disk Space: ~500MB per PHP version (plus cache space)

Linux

  • OS: Linux distribution with GTK 3.0+ and WebKitGTK support
  • Network: Internet connection for downloading PHP versions
  • Disk Space: ~500MB per PHP version (plus cache space)

🎯 Use Cases

  • Web Developers: Switch between PHP versions for different projects
  • System Administrators: Manage PHP installations across multiple environments
  • CI/CD: Use in automated build pipelines
  • Testing: Test applications against multiple PHP versions
  • Learning: Experiment with different PHP versions and features

πŸ”§ Configuration

PHP Version Manager stores configuration in:

  • Windows: %APPDATA%\phpvm\config.json
  • Linux: ~/.config/phpvm/config.json

Default installation paths:

  • Windows: %LOCALAPPDATA%\phpvm\versions\
  • Linux: ~/.local/share/phpvm/versions/

These can be configured through the Settings tab in the application.


πŸ› Troubleshooting

Installation Issues

Problem: PHP version fails to install

  • Solution: Check internet connection and available disk space
  • Solution: Verify checksums are valid (check logs)

Problem: PATH not updating after switching versions

  • Solution: Restart your terminal/command prompt
  • Solution: On Windows, restart the application with administrator privileges if needed

Build Issues

Problem: Build fails with missing dependencies

  • Solution: Ensure all prerequisites are installed (see Prerequisites section)
  • Solution: On Linux, install all required development libraries
  • Solution: On Windows, ensure Visual Studio Build Tools are installed with C++ workload

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Built with Tauri for the GUI framework
  • Powered by Rust for the core logic
  • UI built with React and modern web technologies

πŸ“ž Support


Made with ❀️ using Rust and modern web technologies

⬆ Back to Top