PHP code example of prokhonenkov / yii2-banners-system

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

    

prokhonenkov / yii2-banners-system example snippets




return [
    // ... your config
    'modules' => [
        'bannersSystem' => [
            'class' => \prokhonenkov\bannerssystem\BannersSystem::class,
            'administratorPermissionName' => 'admin', //admin role
            'uploadDir' => '@webroot/media/banners-system',
            'uploadUrl' => '@web/media/banners-system',
        ],
    ],
    'bootstrap' => [        
        'bannersSystem' // add module id to bootstrap for proper aliases and url routes binding
    ]
];




return [
    // ... your config
    'modules' => [
        'bannersSystem' => [
            'class' => \prokhonenkov\bannerssystem\BannersSystem::class,
            'administratorPermissionName' => 'admin', //admin role
            'uploadDir' => '@webroot/media/banners-system',
            'uploadUrl' => '@web/media/banners-system',
            
            'layout' => '@alias/views/layouts/main',
            'views' => [
                'banner' => [
                    'index' => '@path/index',
                    'update' => '@path/update',
                    'create' => '@path/create',
                    'view' => '@path/view',
                ],
                'area' => [
                    'index' => '@path/index',
                    'update' => '@path/update',
                    'create' => '@path/create',
                    'view' => '@path/view',
                ]
            ],
        ],
    ],
];


public function behaviors()
{
    return [
        'banner-system' => [
            'class' => \prokhonenkov\bannerssystem\behaviors\BannerSystemBehavior::class
        ]
    ];
}

<?= \prokhonenkov\bannerssystem\BannerZone::getInstance()->setZoneById(BANNER_ZONE_ID);

php composer.phar 

php yii migrate --migrationPath=@prokhonenkov/bannerssystem/migrations --interactive=0