PHP code example of yii2-bridge / core

1. Go to this page and download the library: Download yii2-bridge/core 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/ */

    

yii2-bridge / core example snippets




return [
    // ... your config
    'modules' => [
        'admin' => [
            'class' => '\Bridge\Core\BridgeModule',
            // Add your projects modules here to keep right routing.
            'modules' => [
                'customModule' => ['class' => '\app\modules\your\CustomModule']
            ],
            // Add menu item of your content management module to menu
            'menu' => [
                [
                    'title' => 'Content',
                    'url' => ['/admin/content/default/index'],
                    'active' => ['module' => 'content'],
                    'icon' => 'list'
                ]
            ],
            // Alternatively you can define different menu items for different
            // roles. In that case it will override default menu items, such as
            // settings, users and dashboard
            'composeMenu' => function ($user, $roles, $authManager) {
                 /**
                  * @var \yii\web\User $user 
                  * @var \Da\User\Model\Role[] $roles
                  * @var \Da\User\Component\AuthDbManagerComponent $authManager 
                  */
                 if (isset($roles['admin'])) {
                     return 


return [
    // ... your config
    'modules' => [
        'admin' => ['class' => '\Bridge\Core\BridgeModule']
    ],
    'bootstrap' => [        
        'admin' // add module id to bootstrap for proper aliases and url routes binding
    ]
]; 

bash
$ php yii user/create EMAIL USERNAME PASSWORD ROLE 
bash
$ php yii user/create [email protected] admin PASSWORD admin
bash
$ php bin/yii.php CONTROLLER/ACTION [params]