wikimedia / composer-merge-plugin

Merge one or more additional composer.json files at Composer runtime
MIT License
926 stars 160 forks source link

Merge laravel don't autodiscover #173

Open anthonyvancauwenberghe opened 5 years ago

anthonyvancauwenberghe commented 5 years ago

Hi,

I'm trying to merge the extra section of 2 composer files in order to stop laravel from autodiscovering packages.

My root extra file looks like this:

image

image

But unfortunately this plugin does not merge it properly. Am i doing something wrong?

bd808 commented 5 years ago

If I am understanding the upstream code correctly, Laravel is doing its own traversal of the composer.json files in the deployment. This means that composer-merge-plugin will have no effect on Laravel's processing. Composer-merge-plugin only modifies in-memory runtime structures for composer ... invocations. It does not write/rewrite files on disk.

anthonyvancauwenberghe commented 5 years ago

hmm so how do i solve this problem then ?

bd808 commented 5 years ago

hmm so how do i solve this problem then ?

This feels like a question to take up with the Laravel community. They may end up redirecting you back here with some better information for us to work from or they may have an easy answer to your problem. It seems unlikely that composer-merge-plugin will be directly applicable unless this Laravel functionality is driven by another Composer plugin that can be made to see the runtime data. Even in that case it may be unsolvable due to load/initialization order issues as we have seen with a few other issues (for example #139).

helingfeng commented 5 years ago

@deviouspk you can try https://github.com/Chester-Hee/LaravelModulesDemo/blob/master/CustomPackagesDiscover.php

anthonyvancauwenberghe commented 5 years ago

for someone who is interested in this i solved it by extending and overriding the package manifest:

https://github.com/larapie/core/blob/master/src/Support/Manifest/PackageManifest.php