Add PHP Scoper configuration for PHAR namespace isolation#602
Open
Add PHP Scoper configuration for PHAR namespace isolation#602
Conversation
All vendor dependencies (nikic/php-parser, symfony/*, phpstan/phpdoc-parser, webmozart/assert, ondram/ci-detector) are prefixed with PhpArkitect\ inside the phar, eliminating conflicts when the host project uses the same libraries. The Arkitect\ namespace is excluded from scoping so end-user config files remain unaffected. https://claude.ai/code/session_01R4VMqad8oVQw3g1HPwPp8G
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #602 +/- ##
=========================================
Coverage 98.31% 98.31%
Complexity 681 681
=========================================
Files 86 86
Lines 1960 1960
=========================================
Hits 1927 1927
Misses 33 33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Composer\InstalledVersions is a Composer runtime class used by our own (non-scoped) Arkitect code. Prefixing it breaks the reference at runtime. https://claude.ai/code/session_01R4VMqad8oVQw3g1HPwPp8G
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds PHP Scoper configuration to the PHAR build process, enabling automatic namespace prefixing of dependencies to prevent conflicts when PHPArkitect is used as a library.
Key Changes
Added
scoper.inc.php: New PHP Scoper configuration file that:_PhpArkitectnamespaceArkitectnamespace from prefixing to preserve the public APIUpdated
box.json: AddedKevinGH\Box\Compactor\PhpScopercompactor to the build pipeline to apply namespace scoping during PHAR compilationUpdated
Makefile: Modified thephartarget to includescoper.inc.phpin the temporary build directoryImplementation Details
The scoping configuration ensures that when PHPArkitect is distributed as a PHAR file, all third-party dependencies are automatically namespaced under
_PhpArkitect, preventing namespace collisions with user code while keeping the mainArkitectnamespace accessible as the public API.https://claude.ai/code/session_01R4VMqad8oVQw3g1HPwPp8G