🍰 CakePHP utilities
Branch: master
Clone or download
georgeconstantinou Merge pull request #166 from QoboLtd/task-9606-assertions
Improve type hints and checks (task #9606)
Latest commit 189b9d0 Feb 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
src Merge branch 'master' into task-9606-assertions Feb 18, 2019
tests Remove var annotation (task #9606) Feb 18, 2019
webroot Add support for CSRF token (task #7073) Jan 14, 2019
.bettercodehub.yml Exclude webroot plugins directory from better code hub (task #812) Sep 19, 2017
.codeclimate.yml
.editorconfig Updated configuration (task #8244) Oct 29, 2018
.gitattributes Updated configuration (task #8244) Oct 29, 2018
.gitignore Updated configuration (task #8244) Oct 29, 2018
.stickler.yml Updated configuration (task #8244) Oct 29, 2018
.travis.yml
LICENSE Copyright years update (task #5220) Jan 18, 2018
README.md Added better code hub badge [ci skip] Sep 19, 2018
composer.json Remove dependency for phpstan/phpstan-webmozart-assert (task #9606) Feb 18, 2019
phpcs.xml.dist Fixed PHP CodeSniffer exclude patterns (task #8244) Nov 1, 2018
phpstan.neon.dist Add assertion library (task #9606) Jan 18, 2019
phpunit.xml.dist Merge tag 'v5.1.0' of github.com:QoboLtd/cakephp-plugin-template into… Oct 29, 2018

README.md

CakePHP3.x Qobo Utils Plugin

Build Status Latest Stable Version Total Downloads Latest Unstable Version License codecov BCH compliance

A variety of utilities that are common and useful for several of our plugins and application.

This plugin is developed by Qobo for Qobrix. It can be used as standalone CakePHP plugin, or as part of the project-template-cakephp installation.

Usage

Install the pugin with composer:

composer require qobo/cakephp-utils

Load the plugin:

bin/cake plugin load Qobo/Utils --bootstrap

Check that the plugin is loaded:

bin/cake plugin loaded

The above should output the list of loaded plugins, with Qobo/Utils being one of them.

Functionality

AdminLTE

One of the primary objectives of this plugin is to simplify the loading and configuration of the AdminLTE theme CakePHP plugin. Here is what you need to set it up.

Load the AdminLTE plugin:

bin/cake plugin load AdminLTE --routes --bootstrap

Load AdminLTE plugin configuration at the bottom of config/bootstrap.php:

Configure::load('admin_lte', 'default');

Here is an example configuration you can stick into config/admin_lte.php:

<?php
return [
    'Theme' => [
        'folder' => ROOT,
        'title' => 'My App',
        'logo' => [
            // This will be displayed when main menu is collapsed.
            // You can use an <img> tag in here or anything else you want.
            'mini' => 'A',
            // This will be displayed when main menu is expanded.
            // You can use an <img> tag in here or anything else you want.
            'large' => 'My App',
        ],
        'login' => [
            'show_remember' => true,
            'show_register' => false,
            'show_social' => false,
        ],
    ],
];

Load AdminLTE theme in beforeRender() method of src/Controller/AppController.php:

// At the top of the file, together with other use statements:
use Cake\Core\Configure;

public function beforeRender(Event $event)
{
    $this->viewBuilder()->theme('AdminLTE');
    $this->set('theme', Configure::read('Theme'));
    // $this->set('user', $this->Auth->user());
    $this->set('user', []);
}

Load AdminLTE Form Helper in initialize() method of src/View/AppView.php:

public function initialize()
{
    $this->loadHelper('Form', ['className' => 'AdminLTE.Form']);
}

For more information on initializing and configuring the AdminLTE theme, see plugin documentation