PHP code example of blackcube / mcp

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

    

blackcube / mcp example snippets


use Blackcube\Mcp\Dboard\McpAddon;

return [
    'yiisoft/db-migration' => [
        'sourceNamespaces' => [
            'Blackcube\\Dboard\\Migrations',
            'Blackcube\\Dcore\\Migrations',
            'Blackcube\\Mcp\\Migrations',
        ],
    ],
    'blackcube/dboard' => [
        'addons' => [
            'mcp' => [
                'rbac' => [McpAddon::class, 'getRbac'],
                'sidebar' => [McpAddon::class, 'getSidebar'],
                'routes' => [McpAddon::class, 'getRoutesGroup'],
                'population' => [McpAddon::class, 'getPopulation'],
                'scopes' => [McpAddon::class, 'getScopes'],
            ],
        ],
    ],
    'blackcube/mcp' => [
        'endpoint' => '/mcp',
        'locale' => 'en',
        'maxTtlDays' => 180,
        'defaultTtlDays' => 90,
        'allowedHosts' => ['cms.example.com'],
    ],
];
bash
php yii.php migrate:up
php yii.php mcp:keyCreate --name="content agent" --scopes=MCP:CONNECT,CONTENT:VIEW