PHPx (temporary name) is an idea to build a all-in-one single binary PHP distribution, which contains all PHP extensions, a Webserver, Package Manager, Formatter/Linter for best development experience working with PHP.
Ideas:
- Production Ready Webserver
- Package Manager that is equal to Composer
- Formatter/Linter that uses Mago
- A builtin test runner?
- A
phpx.tomlfile to configure PHP settings likememory_limitor other things
- Regular Webserver
- Worker Mode similar to FrankenPHP
- [_] Production Ready
- Install Packages
- Update Packages
- Remove Packages
- Audit Packages
- [_] Composer Plugins
- [_] Formatter/Linter that uses Mago
phpx 0.1.0 - PHP 8.5.1 embedded in Rust
Usage: phpx [options] [-f] <file> [--] [args...]
phpx [options] -r <code> [--] [args...]
phpx server [options] [router.php]
Options:
-d key[=value] Define INI entry
-i PHP information (phpinfo)
-l Syntax check only (lint)
-m Show compiled in modules
-r <code> Run PHP <code> without script tags
-v Version information
-h, --help Show this help message
Subcommands:
init Create a new composer.json in current directory
install Install project dependencies from composer.lock
update Update dependencies to their latest versions
add Add a package to the project
remove Remove a package from the project
run Run a script defined in composer.json
server Start a PHP development server
pm Other package manager commands (show, validate, etc.)
Run 'phpx --help' for more options.
PHPx supports a local phpx.toml configuration file in your project directory. This file allows you to configure PHP runtime settings and development server options.
# PHP runtime configuration
[php.ini]
memory_limit = "256M"
max_execution_time = "30"
display_errors = "On"
error_reporting = "E_ALL"
# Development server configuration
[server]
host = "0.0.0.0"
port = 8080
document_root = "public"
router = "index.php"
# worker = "worker.php" # Optional: Enable worker mode
# workers = 4 # Number of worker threads
# watch = ["**/*.php"] # File patterns to watch for auto-reloadAny PHP INI setting can be specified here as key-value pairs. These settings are applied when PHP is initialized. CLI arguments (-d) take precedence over config file settings.
| Option | Type | Description |
|---|---|---|
host |
string | Address to bind to (default: "127.0.0.1") |
port |
number | Port to listen on (default: 8000) |
document_root |
string | Document root directory (default: ".") |
router |
string | Router script path (optional) |
worker |
string | Worker script for long-running mode (optional) |
workers |
number | Number of worker threads (default: CPU cores) |
watch |
array | Glob patterns for file watching (optional) |
Settings are merged with the following priority (highest to lowest):
- CLI arguments (e.g.,
-d memory_limit=512M) phpx.tomlconfiguration file- Built-in defaults
❯ phpx pm
Package manager commands (show, validate, dump-autoload)
Usage: phpx pm <COMMAND>
Commands:
audit Check for security vulnerabilities in installed packages
bump Bump version constraints in composer.json to locked versions
exec Execute a vendored binary/script
search Search for packages on Packagist
show Show information about packages
validate Validate composer.json and composer.lock
dump-autoload Regenerate the autoloader
why Show why a package is installed
outdated Show outdated packages
clear-cache Clear the Composer cache
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help