PHP code example of ndoubismarck / cakephp-modules

1. Go to this page and download the library: Download ndoubismarck/cakephp-modules 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/ */

    

ndoubismarck / cakephp-modules example snippets


public function bootstrap(): void
{
    parent::bootstrap();
    $this->addPlugin('Modules');
}

use Cake\Controller\Controller;
use Modules\ModuleAwareTrait;

/**
 * @property ExampleModule $ExampleModule
 */
class AppController extends Controller
{
    use ModuleAwareTrait;
    
    public function initialize(): void
    {
        $this->loadModule('Example');
    }
}

use Modules\ModuleAwareTrait;

/**
 * @property ExampleModule $ExampleModule
 */
class MyClass
{
    use ModuleAwareTrait;
    
    public function __construct()
    {
        $this->loadModule('Example');
    }
}