3

I am working on a complex application that is divided in some sub-applications with their own logic. Those sub-applications are included in composer.json file of the main application and the module paths of sub-application are included in the main application.

For example main app module_paths contains:

./vendor,
./vendor/app1/module
./vendor/app2/module

The problem is that both app1 and app2 have a module with the same name and both of them need to be loaded in the main application.

Is there a way to load 2 modules with the same name but from different sources?

Wilt
  • 41,477
  • 12
  • 152
  • 203
  • not possible to alias the offending module? `use \whatever\this as that;` – Dale Nov 16 '15 at 16:32
  • 1
    It's a best practise to always use a vendor prefix for module names to avoid exactly this situation. See here -> http://framework.zend.com/manual/current/en/modules/zend.module-manager.best-practices.html#utilize-a-vendor-prefix-for-module-names The ideal is to persuade the vendors to follow best practise and adopt a vendor prefix for their modules. – Crisp Nov 16 '15 at 17:31

1 Answers1

2

As @Crisp suggests the problem could best be solved with a vendor prefix in the module name.

Instead of persuading the vendor and waiting for their next release you can easily make a fork of the repository on GitHub and use your fork with the prefix in your application.

On how to include your custom fork into composer.json you can read here.

If you do this you can even make a pull-request which might encourage the vendors to merge your pre-fix solution into their branch.

Wilt
  • 41,477
  • 12
  • 152
  • 203