Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare Dependency Between Modules #263

Open
XedinUnknown opened this issue Mar 20, 2023 · 2 comments
Open

Declare Dependency Between Modules #263

XedinUnknown opened this issue Mar 20, 2023 · 2 comments

Comments

@XedinUnknown
Copy link

XedinUnknown commented Mar 20, 2023

I use this awesome plugin to create modular software, each module having its own composer.json. This allows me to keep declarations of module dependencies together with modules, greatly simplifying understanding and portability. So, there's an e.g. my/main package, which uses the plugin to merge modules/module1/composer.json and modules/module2/composer.json. Feels like this is exactly what the plugin is made for.

Now, module2 depends on symbols from module1. If the symbols were in an external package, I could just have both modules depend on that package, and it would work, as it has for a number of years now. But most often, local modules are local because they have something that is considered not worth extracting into a separate package (at that time). Still, symbols need to be shared, and so in my/module2 I tried declaring dependency on my/module1: *. This serves as an explicit dependency declaration, providing a logical link between modules. When/if the modules need to be extracted into separate packages, I wouln't have to go through the code looking for class usages, and resolving them to their respective packages, which is a long-term added benefit of such a declaration.

Alas, it gives the Root composer.json requires my/module1, it could not be found in any version, there may be a typo in the package name error. Is this supposed to be working, and I just need to fix some configuration? If not, is this something you are planning to add? Is it possible at all?

Thanks! 🙏

@jbrada
Copy link

jbrada commented Jun 14, 2023

Hi @XedinUnknown,

I just came across this issue. Have you been able to figure out how to deal with internal dependencies?
So far the replace section works for me as a workaround, but it's not quite what I'm looking for.

@XedinUnknown
Copy link
Author

Hi @jbrada!

I have put this on pause for now, as it doesn't block anything. However, now thinking about it a bit more, I guess you could add your internal dependencies as local path repositories. Don't know if this will work, but at least this is how I'd address the immediate error message.

If you try it, I'd be curious if it works. I guess, adding those to the composer config "automatically" by the plugin would be a step in supporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants