Skip to content

Add disablePackageReplace() and disableAutoloadMerge() opt-outs for non-library monorepos#114

Merged
kayw-geek merged 3 commits into
symplify:mainfrom
kayw-geek:feature/disable-replace-selction
Apr 22, 2026
Merged

Add disablePackageReplace() and disableAutoloadMerge() opt-outs for non-library monorepos#114
kayw-geek merged 3 commits into
symplify:mainfrom
kayw-geek:feature/disable-replace-selction

Conversation

@kayw-geek

@kayw-geek kayw-geek commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two opt-in switches on MBConfig for monorepos that are not published as a library (e.g. Laravel apps using path repos + self.version requires):

  • MBConfig::disablePackageReplace() — skip ReplaceSectionJsonDecorator. The default replace: { internal/pkg: self.version } makes Composer treat the root as already providing internal packages → they're never installed → never appear in vendor/composer/installed.json → Laravel's package auto-discovery breaks. Opting out fixes this.
  • MBConfig::disableAutoloadMerge() — skip merging autoload / autoload-dev from package composer.json into root. With replace disabled, internal packages get installed via path repos and bring their own autoload, so the merged root entries become redundant (duplicate PSR-4 mappings).

Both follow the existing static-flag pattern of MBConfig::disableDefaultWorkers(). Default behavior unchanged.

Usage

return static function (MBConfig $mbConfig): void {
    MBConfig::disablePackageReplace();
    MBConfig::disableAutoloadMerge();
};

Test plan

  • New unit tests cover default + disabled paths for replace section, autoload merge, and autoload-dev merge
  • Full suite green (67/275)
  • composer check-cs, composer check-rector, phpstan clean

@kayw-geek kayw-geek force-pushed the feature/disable-replace-selction branch from 6e08787 to f226aa5 Compare April 22, 2026 02:47
@kayw-geek kayw-geek changed the title Add disablePackageReplace() to opt out of self.version replace section Add disablePackageReplace() and disableAutoloadMerge() opt-outs for non-library monorepos Apr 22, 2026
@kayw-geek kayw-geek merged commit 5915857 into symplify:main Apr 22, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant