PHP code example of 2dojo / module_manager

1. Go to this page and download the library: Download 2dojo/module_manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

2dojo / module_manager example snippets




namespace App\Providers;

...

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        ModuleManager::initializeModules();
    }
}

// config/module_manager.php
'registry' => 'database'



namespace App\Modules;

use TwoDojo\Module\AbstractModule;

class ExampleModule extends AbstractModule
{
    /**
    * @var string The module display name
    */
    protected $name = 'ExampleModule';
}



namespace App\Providers;

...

class PackageServiceProvider extends ServiceProvider
{
    public function boot()
    {
        ModuleManager::registerModule(ExampleModule::class);
        
        ...
    }
}

/**
* Register a module to the module manager.
*
* @param string $moduleClass The module class
* @return bool
*/
public function registerModule(string $moduleClass) : bool

/**
* Initialize the registered modules
*/
public function initializeModules()

/**
 * Enable a module
 *
 * @param $uniqueName The module unique name
 * @return bool
 */
public function enableModule($uniqueName) : bool

/**
 * Disable a module
 *
 * @param string $uniqueName The module unique name
 * @return bool
 */
public function disableModule($uniqueName) : bool

php artisan vendor:publish --provider="TwoDojo\ModuleManager\ModuleManagerServiceProvider"

php artisan migrate