eugenec138 / cakephp-utils
CakePHP 工具
v1.0.3
2023-07-03 09:03 UTC
Requires
- admad/cakephp-jwt-auth: ^2.0
- alt3/cakephp-swagger: ^1.0
- burzum/cakephp-file-storage: ^1.2
- burzum/cakephp-imagine-plugin: ^2.1
- cakedc/users: ^4.0
- cakephp/cakephp: ^3.10.5
- cakephp/migrations: ~1.0
- doctrine/annotations: v1.4.0
- doctrine/instantiator: 1.0.5
- friendsofcake/crud: ^5.2
- fzaninotto/faker: ^1.0
- league/csv: ^8.1
- league/json-guard: ^0.5
- lorenzo/audit-stash: ^1.0
- maiconpinto/cakephp-adminlte-theme: ^1.0
- muffin/trash: ^1.1
- myclabs/php-enum: ^1.5
- piwik/ini: ^1.0
- pyrech/composer-changelogs: ^1.4
- zircote/swagger-php: 2.0.8
Requires (Dev)
- cakephp/cakephp-codesniffer: ^3.0
- phpunit/phpunit: ^5.0
This package is auto-updated.
Last update: 2024-10-03 11:36:53 UTC
README
提供各种工具,这些工具在我们的插件和应用程序中非常常见且实用。
用法
使用 composer 安装插件
composer require qobo/cakephp-utils
加载插件
bin/cake plugin load Qobo/Utils --bootstrap
检查插件是否加载
bin/cake plugin loaded
上述操作应输出加载的插件列表,其中应包含 Qobo/Utils
。
功能
AdminLTE
该插件的主要目标之一是简化 CakePHP 插件 AdminLTE 的加载和配置。以下是需要设置的步骤。
加载 AdminLTE 插件
bin/cake plugin load AdminLTE --routes --bootstrap
在 config/bootstrap.php
文件的底部加载 AdminLTE 插件配置
Configure::load('admin_lte', 'default');
以下是一个可以放入 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, ], ], ];
在 src/Controller/AppController.php
文件的 beforeRender()
方法中加载 AdminLTE 主题
// 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', []); }
在 src/View/AppView.php
文件的 initialize()
方法中加载 AdminLTE 表单助手
public function initialize() { $this->loadHelper('Form', ['className' => 'AdminLTE.Form']); }
有关初始化和配置 AdminLTE 主题的更多信息,请参阅 插件文档