PHP code example of kavezoo / kvadmin

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

    

kavezoo / kvadmin example snippets


public function bootstrap(): void
{
    parent::bootstrap();

    // Load more plugins here
    $this->addPlugin('KvAdmin', ['routes' => true, 'bootstrap' => true]);
}

use Cake\Core\Configure;

Configure::write('Bake.theme', 'KvAdmin');

Configure::write('Session', [
    'defaults' => 'php',
    'cookie' => 'NameOfCookie',
    'timeout' => 4320, // 3 days
]);

public function initialize(): void
{
    parent::initialize();

    $this->loadHelper('KvAdmin.SystemIcon');
    $this->loadHelper('KvAdmin.Icon');
    $this->loadHelper('KvAdmin.KvForm');
}


declare(strict_types=1);

namespace App\Controller\Admin;

use KvAdmin\Controller\AppController as KvAdminAppController;

class AppController extends KvAdminAppController
{
    public function initialize(): void
    {
        parent::initialize();
    }
}

$routes->prefix('Admin', function (RouteBuilder $builder) {
    $builder->setRouteClass(DashedRoute::class);
    $builder->connect('/', ['controller' => 'Cities', 'action' => 'index']);
    $builder->fallbacks();
});

$routes->prefix('Member', function (RouteBuilder $builder) {
    $builder->setRouteClass(DashedRoute::class);
    $builder->connect('/', ['controller' => 'Clubs', 'action' => 'index']);
    $builder->fallbacks();
});


declare(strict_types=1);

namespace App\Controller\Member;

use KvAdmin\Controller\AppController as KvAdminAppController;

class AppController extends KvAdminAppController
{
    public function initialize(): void
    {
        parent::initialize();
    }
}
bash
mkdir -p templates/Admin/element
cp vendor/kavezoo/kvadmin/templates/element/header.php templates/Admin/element/header.php
cp vendor/kavezoo/kvadmin/templates/element/topheader.php templates/Admin/element/topheader.php
cp vendor/kavezoo/kvadmin/templates/element/footer.php templates/Admin/element/footer.php
cp vendor/kavezoo/kvadmin/templates/element/topheader_user_menu.php templates/Admin/element/topheader_user_menu.php