Laravel-modules: Dependency between module

Created on 20 Apr 2020  路  5Comments  路  Source: nWidart/laravel-modules

Hello,

For a given Module (ex: MyModule), how can I define that requires the Module A and Module B to work?

I read that this used to be configured in the option "requires" of the module.json file. But I also read that this feature is depracated.

Thank you.

All 5 comments

There's nothing to do on this package level for that.
Dependencies in PHP are handles by Composer, you can use this to define dependencies.

@nWidart,

I guess you didn't understand my request. I was talking about dependency between Modules of this package.

A better example: I have two modules: Users and Buys, but for the module Buys to work, this module require that the module Users exists and is enabled.

Thank you and sorry if I didn't explain well what I wanted to mean.

Hi,

I think I understood the request correctly. Modules are packages, thus you can use composer to define dependencies to other modules too.

@nWidart ,

Oh, ok. :)

So, you're saying that the composer.json file of module Buys I need to had this:

"require": {
"module_name": "version"
}

Thank you.

Yup indeed, a module acts just like any other package.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

developh picture developh  路  3Comments

Levivb picture Levivb  路  4Comments

vdjkelly picture vdjkelly  路  4Comments

morningmemo picture morningmemo  路  3Comments

NexxusPlexx picture NexxusPlexx  路  4Comments