This page lists the public methods of one module (Nwidart\Modules\Module) and of Nwidart\Modules\Json, the class that reads module.json and composer.json. To find modules, see Module facade and repository.
Replaces the module folder of this instance. Writes nothing to disk.
getExtraPath(?string $path)
string
The module folder, / and $path. The module folder alone when $path is null or empty.
getAppPath()
string
The folder given by modules.paths.app_folder inside the module, without a trailing slash. The module folder when that folder does not exist.
getCachedServicesPath()
string
Provider cache path: the application’s cached services path with services.php replaced by <snake_name>_module.php. Under modules.vapor_maintenance_mode, replaces config.php in the cached config path. Abstract in Module.
Fires enabling, enables the module through the activator, fires enabled.
disable()
void
Fires disabling, disables the module through the activator, fires disabled.
delete()
bool
Fires deleting, removes the activator status, deletes the module folder, and fires deleted. Returns whether folder deletion succeeded. Does not clear the repository scan cache (unlike Repository::delete()).
fireEvent(string $event)
void
Dispatches the event modules.<lowername>.<event> with the module as payload. See Events.
registerAliases()
void
Registers the aliases of module.json with Laravel’s AliasLoader. Abstract in Module.
registerProviders()
void
Loads the providers of module.json through Laravel’s ProviderRepository. Abstract in Module.
A status change takes effect on the next request or command. The package registers the providers of enabled modules when the application boots.
Both methods are deprecated and removed in version 14. The package no longer calls them. Module files and providers are loaded through ModuleManifest.
Signature
Returns
Description
register()
void
Registers aliases and providers, includes the files of module.json, and fires register.
boot()
void
Registers the module translations when modules.register.translations is true, and fires boot. It also includes the files when modules.register.files is 'boot'.
Reads and decodes the file. Throws InvalidJsonException when the content is not valid JSON, and Laravel’s FileNotFoundException when the file does not exist.