Skip to content

Declare Dependency Between Modules #263

Open
@XedinUnknown

Description

@XedinUnknown

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! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions