-
Notifications
You must be signed in to change notification settings - Fork 32
Facade
Get all of the modules.
$all = Module::all();
Get all the cached modules.
$cached = Module::getCached()
Get ordered modules. The modules will be ordered by the priority
key in module.json
file.
$ordered = Module::getOrdered();
Get scanned modules.
$scanned = Module::scan();
Get the instance of a specific module.
$blog = Module::get('my-blog');
In case the module is not found, Nwidart\Modules\Exeptions\ModuleNotFoundException
will be thrown.
$blog = Module::findOrFail('my-blog');
Get scanned paths.
Module::getScanPaths();
Get all modules as a collection instance.
$collection = Module::toCollection();
Get modules by status. 1 for active and 0 for inactive.
Module::getByStatus(1);
Check the specified module. If exists, it will return true
, otherwise false
.
$has = Module::has('my-blog');
Get all enabled modules.
$enabled = Module::allEnabled();
Get all disabled modules.
$disabled = Module::allDisabled();
Get the number of all modules.
$number = Module::count();
Get the module path.
$path = Module::getPath();
Register the modules.
Module::register();
Boot all available modules.
Module::boot();
Get all enabled modules as a collection instance.
$collection = Module::collections();
Get the module path from the specified module.
$module_path = Module::getModulePath('my-blog');
Get the assets path from the specified module.
$asset_path = Module::assetPath('my-blog');
Get config value from this package.
Module::config('my-blog.name');
Get used storage path.
Module::getUsedStoragePath();
Get the used module for the CLI session.
Module::getUsedNow();
// OR
Module::getUsed();
Set the used module for the CLI session.
Module::setUsed('my-blog');
Get the modules' assets path.
Module::getAssetsPath();
Get an asset URL from a specific module.
$url = Module::asset('my-blog:img/logo.img');
Install the specified module by the given module alias.
Module::install('my-blog');
Update dependencies for the specified module.
Module::update('my-blog');
Add a macro to the module repository.
Module::macro('hello', function() {
echo "I'm a macro";
});
Call a macro from the module repository.
Module::hello();
Get all required modules of a module
$requirements = Module::getRequirements('my-blog');