humbug/php-scoper
PHP-Scoper moves any body of code, including all vendor dependencies, into a new distinct namespace. This prevents conflicts when building PHARs that bundle their own dependencies and interact with other PHP projects.
composer install is prohibited).Adopt if:
Look elsewhere if:
create_function) or unsupported PHP features (see Limitations).For Executives:
"PHP-Scoper lets us package our PHP tools as single, self-contained files (PHARs) with locked-in dependencies—eliminating version conflicts and reducing support costs. For example, we could distribute our CLI tool as a single executable (no vendor/ folder needed), improving security and deployment simplicity. This aligns with our goals of [X: cost savings/offline support/global reach] while maintaining compatibility with existing PHP ecosystems."
For Engineering: *"This tool automates namespace isolation for PHARs, solving the ‘vendor hell’ problem when bundling dependencies. Key benefits:
src/ and vendor/.composer dump-autoload to ensure autoloading works post-scoping.Trade-offs:
call_user_func() with strings).Proposal:
php-scoper into CI/CD (e.g., GitHub Actions) for builds.How can I help you explore Laravel packages today?