php-ini-automation
v5.0.8
Published
Ultimate Laravel-optimized PHP configuration tool that automatically detects and configures PHP installations across all environments with Laravel 10+ specific extensions, performance settings, and security configurations
Maintainers
Readme
PHP INI Automation v4.1 🚀
The Ultimate Laravel-Optimized PHP Configuration Tool - Intelligent, Powerful, Laravel-Ready
Revolutionary cross-platform PHP detection and configuration tool specifically optimized for Laravel development. Automatically finds and configures ALL your PHP installations with Laravel-specific extensions, performance settings, and security configurations across ANY environment and ANY operating system!
🎯 Quick Start: npm install -g php-ini-automation && pia
🚀 Laravel Ready: Optimized for Laravel 10+ with all required extensions and performance settings
🌟 Revolutionary Features
🔍 Intelligent Detection System
- 🎯 Multi-Method Detection: System PATH, Windows Registry, Deep Scanning, Environment Variables
- 🏗️ Universal Environment Support: Laragon, XAMPP, WAMP, PVM, MAMP, Uniform Server, Bitnami, Custom
- 🔄 Multi-Version Detection: Automatically finds ALL PHP versions in each environment
- 📊 Comprehensive Analysis: Architecture, Thread Safety, Build Date, Configuration details
⚡ Professional CLI Experience
- 🎨 Beautiful Interface: Colored output, formatted tables, progress indicators
- 🤖 Interactive Selection: Choose from detected installations with smart defaults
- 📋 Detailed Reporting: Real-time feedback on extensions and settings
- 🛡️ Validation System: Pre-flight checks and troubleshooting suggestions
🚀 Advanced Configuration
- 📦 Smart Extension Management: Validates extension files before enabling
- ⚙️ Laravel-Optimized Settings: Performance, security, and development settings
- 💾 Automatic Backup: Timestamped backups before any changes
- 🔧 Custom Settings Support: Add your own PHP configurations
🎯 Laravel-Specific Optimizations
📦 Essential Extensions (Auto-Enabled)
- Core Requirements: curl, mbstring, openssl, tokenizer, xml, ctype, json, fileinfo
- Database Support: pdo_mysql, pdo_sqlite, pdo_pgsql, mysqli, sqlite3
- Laravel Features: bcmath, gd, zip, intl, soap, xsl, ldap, exif
- Performance: opcache, apcu
⚙️ Performance Settings
- Memory: 1GB limit for Composer and migrations
- Execution Time: 300 seconds for Artisan commands
- File Uploads: 256MB support for large files
- OPcache: Optimized for Laravel with 512MB cache
- Realpath Cache: 8MB cache for faster file resolution
🔒 Security Configurations
- Session Security: HTTPOnly, SameSite, Strict Mode
- PHP Exposure: Hidden version information
- Error Handling: Development-friendly error reporting
- File Access: Secure file upload and include settings
🎯 Laravel-Ready Features
- Timezone: UTC default for consistent timestamps
- Encoding: UTF-8 for international support
- Artisan Support: CLI optimizations for Artisan commands
- Composer Ready: Memory and time limits for package management
🌍 Cross-Platform Support
🪟 Windows Environments
| Environment | Multi-Version | Auto-Detection | Deep Scan | Priority | |-------------|---------------|----------------|-----------|----------| | System PATH | ✅ | ✅ | ✅ | 🥇 Highest | | Laragon | ✅ | ✅ | ✅ | 🥈 High | | PVM | ✅ | ✅ | ✅ | 🥉 High | | WAMP/WAMP64 | ✅ | ✅ | ✅ | 🏅 Medium | | XAMPP | ✅ | ✅ | ✅ | 🏅 Medium | | MAMP | ✅ | ✅ | ✅ | 🏅 Medium | | Uniform Server | ✅ | ✅ | ✅ | 🏅 Medium | | Bitnami | ✅ | ✅ | ✅ | 🏅 Medium |
🐧 Linux Environments
| Environment | Multi-Version | Auto-Detection | Deep Scan | Priority | |-------------|---------------|----------------|-----------|----------| | System PATH | ✅ | ✅ | ✅ | 🥇 Highest | | Ubuntu/Debian APT | ✅ | ✅ | ✅ | 🥈 High | | CentOS/RHEL YUM/DNF | ✅ | ✅ | ✅ | 🥉 High | | Homebrew | ✅ | ✅ | ✅ | 🏅 Medium | | Custom/Compiled | ✅ | ✅ | ✅ | 🏅 Low |
🍎 macOS Environments
| Environment | Multi-Version | Auto-Detection | Deep Scan | Priority | |-------------|---------------|----------------|-----------|----------| | System PATH | ✅ | ✅ | ✅ | 🥇 Highest | | Homebrew | ✅ | ✅ | ✅ | 🥈 High | | MAMP | ✅ | ✅ | ✅ | 🥉 High | | Custom/Compiled | ✅ | ✅ | ✅ | 🏅 Low |
🔍 Detection Methods
- System PATH Scanning - Finds active PHP installations
- Windows Registry - Discovers registered PHP installations
- Environment Variables - Respects manual configurations
- Deep Directory Scanning - Recursively searches common paths
- Intelligent Pattern Matching - Recognizes PHP directory structures
Installation
Global Installation (Recommended)
npm install -g php-ini-automation🎉 After installation, you can use the short alias
piainstead ofphp-ini-automation!
Local Installation
npm install php-ini-automation🎯 Quick Reference
⚡ Essential Shortcuts
| Command | Description | Example |
|---------|-------------|---------|
| pia | Configure PHP (auto-detect) | pia |
| pia -l | List all PHP installations | pia -l |
| pia -v | Show version information | pia -v |
| pia -h | Show help | pia -h |
| pia 8.2 | Configure specific PHP version | pia 8.2 |
🔥 One-Liner Examples
# Quick setup for Laravel development
pia
# Check what PHP versions are available
pia -l
# Configure PHP 8.2 specifically
pia 8.2
# Get help and see all options
pia -h
# Check tool version
pia -vUsage
🚀 Quick Start Commands
⚡ Super Quick (Recommended)
# Configure PHP (auto-detect)
pia
# List all PHP installations
pia -l
# Show version information
pia -v
# Show help
pia -h
# Configure specific PHP version
pia 8.2📋 All Available Commands
# Main commands
php-ini-automation # Auto-detect and configure PHP
pia # Short alias (same as above)
# Version-specific
php-ini-automation 8.2 # Configure PHP 8.2
pia 8.2 # Short form
# Information commands
php-ini-automation --list # List all detected installations
pia -l # Short form
php-ini-automation --version # Show version information
pia -v # Short form
php-ini-automation --help # Show help
pia -h # Short form
# Advanced options
php-ini-automation --non-interactive # Run without prompts
pia --non-interactive # Short formCommand Line Interface
# Use default PHP version
php-ini-automation
pia # Short alias
# Specify PHP version
php-ini-automation 8.2
pia 8.2 # Short form
# With environment variables
LARAGON_PATH="C:/laragon" php-ini-automation 8.1
LARAGON_PATH="C:/laragon" pia 8.1 # Short formProgrammatic Usage
import { updatePhpIni, customizePhpIni } from 'php-ini-automation';
// Update PHP ini for default version
await updatePhpIni();
// Update PHP ini for specific version
await updatePhpIni('8.2');
// Custom settings
await customizePhpIni('/path/to/php.ini', '/path/to/ext', {
memory_limit: '1G',
max_execution_time: 300
});Environment Variables
Set these environment variables to help the tool locate your PHP installation:
# For Laragon
LARAGON_PATH=C:/laragon
# For XAMPP
XAMPP_PATH=C:/xampp
# For WAMP
WAMP_PATH=C:/wamp64
# For PVM (PHP Version Manager)
PVM_PATH=C:/tools/php
# Custom PHP installation
DEFAULT_PATH=C:/phpExtensions Enabled
The tool automatically enables these PHP extensions required by Laravel:
- curl
- pdo_sqlite
- sqlite3
- openssl
- pdo_mysql
- mbstring
- tokenizer
- json
- fileinfo
- ctype
- xml
- bcmath
- gd
- zip
Default Settings Applied
max_execution_time = 120
memory_limit = 512M
output_buffering = Off
zlib_output_compression = OffDevelopment
Prerequisites
- Node.js 16+
- TypeScript 5+
Setup
git clone https://github.com/yourusername/php-ini-automation.git
cd php-ini-automation
npm installBuild
npm run buildDevelopment Mode
npm run devAPI Reference
updatePhpIni(version?: string): Promise<void>
Updates the php.ini configuration for the specified PHP version.
Parameters:
version(optional): PHP version to update for (e.g., '8.2', '8.1')
customizePhpIni(filePath: string, extensionsDir: string, customSettings?: Record<string, string | number>): Promise<void>
Customizes a specific php.ini file with extensions and settings.
Parameters:
filePath: Path to the php.ini fileextensionsDir: Directory containing PHP extensionscustomSettings(optional): Additional PHP settings to apply
determinePhpIniPaths(version?: string): { iniPath: string, extensionDir: string }
Determines the appropriate paths for php.ini and extensions directory.
Parameters:
version(optional): PHP version
Returns:
- Object with
iniPathandextensionDirproperties
validateSourceFile(filePath: string): void
Validates that a php.ini file exists at the specified path.
Parameters:
filePath: Path to validate
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
