Helpers

Facade

Module Discovery

Get all modules.

Module::all();

Get all cached modules.

Module::getCached()

Get ordered modules. The modules will be ordered by the priority key in module.json file.

Module::getOrdered();

Get scanned modules.

Module::scan();

Find a specific module.

Module::find('name');
// OR
Module::get('name');

Find a module, if there is one, return the Module instance, otherwise throw Nwidart\Modules\Exceptions\ModuleNotFoundException.

Module::findOrFail('module-name');

Get scanned paths.

Module::getScanPaths();

Get all modules as a collection instance.

Module::toCollection();

Get modules by the status. 1 for active and 0 for inactive.

Module::getByStatus(1);

Check the specified module. If it exists, will return true, otherwise false.

Module::has('blog');

Get all enabled modules.

Module::allEnabled();

Get all disabled modules.

Module::allDisabled();

Get count of all modules.

Module::count();

Get module path.

Module::getPath();

Register the modules.

Module::register();

Boot all available modules.

Module::boot();

Get all enabled modules as collection instance.

Module::collections();

Get module path from the specified module.

Module::getModulePath('name');

Get assets path from the specified module.

Module::assetPath('name');

Get config value from this package.

Module::config('composer.vendor');

Get used storage path.

Module::getUsedStoragePath();

Get used module for cli session.

Module::getUsedNow();
// OR
Module::getUsed();

Set used module for cli session.

Module::setUsed('name');

Get modules's assets path.

Module::getAssetsPath();

Get asset url from specific module.

Module::asset('blog:img/logo.img');

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

Module::getRequirements('module name');

Module Methods

Get an entity from a specific module.

$module = Module::find('blog');

Get module name.

$module->getName();

Get module name in lowercase.

$module->getLowerName();

Get module name in studlycase.

$module->getStudlyName();

Get module path.

$module->getPath();

Disable the specified module.

$module->disable();

Enable the specified module.

$module->enable();

Delete the specified module.

$module->delete();

Get an array of module requirements. Note: these should be aliases of the module.

$module->getRequires();