Use Case Alignment:
humbug/box as a first-class citizen for:
Anti-Patterns (Unchanged):
Storage::put() during runtime).phar::validateSignature()).queue:work --fiber) work seamlessly in PHARs, as they rely on PHP 8.5’s Fiber runtime.opcache.preload integrates natively with PHARs, enabling near-instant cold starts for CLI tools.phar::mapPhar() to embed PHP 8.5-specific optimizations (e.g., JIT flags, Fiber bootstrapping).{
"scripts": {
"build-phar": "box build --php=8.5 --main=stub.php --output=app.phar --stub=stub_85.php",
"optimize": "php -d opcache.jit_buffer_size=100M -d opcache.enable_cli=1 app.phar optimize"
}
}
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| PHP 8.5 Breaking Changes | Low | Test PHARs with php -v 8.5 and validate against Laravel 10’s minimum requirements. Use platform-check in Composer. |
| Fiber/Async Quirks | Medium | Avoid mixing Fiber-based commands with blocking I/O (e.g., Artisan::call() with sync DB operations). |
| PHAR Security | High | Enforce signature validation (phar::validateSignature()) and restrict PHAR execution to trusted paths. |
| OPcache Preloading | Medium | Preload PHARs in php.ini for CLI (opcache.preload=/path/to/app.phar) and monitor memory usage. |
| JIT Compatibility | Low | Enable JIT in PHAR runtime (php -d opcache.jit=12345 app.phar). Monitor for edge cases in async workers. |
app:env, app:provide) that require PHAR-specific adjustments (e.g., environment variable handling in PHAR stubs)?vendor/bin/ execution? Benchmark with php -d opcache.enable_cli=1.php.ini) or per-request (e.g., via opcache.preload in CI/CD)?--fiber for async processing.php app.phar queue:work --fiber).opcache.enable_cli=1) and preload PHARs (opcache.preload).ext-opcache, ext-pcntl (for workers), and ext-sodium (for PHAR signing).composer create-project laravel/laravel laravel-phar-test --prefer-dist
cd laravel-phar-test
composer require humbug/box --dev
composer build-phar # Custom script (see above)
php app.phar --version
php -d opcache.jit=12345 app.phar artisan --fiber queue:work
vendor/bin/artisan with PHAR for Laravel 10 CLI tools.--fiber support.platform-check to enforce PHP 8.5:
{
"config": {
"platform-check": true,
"platform": {
"php": "8.5.0"
}
}
}
#!/bin/bash
if php -r "echo PHP_VERSION;" | grep -q "8.5"; then
php app.phar "$@"
else
vendor/bin/artisan "$@"
fi
| Component | Compatibility Notes |
|---|---|
| Laravel 10+ | Full support; leverage PHP 8.5 features like Fiber for async Artisan. |
| Horizon | Works with --fiber flag for async workers (PHP 8.5 required). |
| Livewire CLI | Can be bundled if using PHP 8.5’s Fiber for reactive updates. |
| PHP 8.5 Extensions | Test with ext-opcache, ext-pcntl, and ext-sodium (for PHAR signing). |
| OPcache | Preloading PHARs (opcache.preload) reduces cold starts by ~40%. |
| Docker/K8s | Use php:8.5-cli-alpine with OPcache preload in Dockerfile. |
How can I help you explore Laravel packages today?