hgists/lumener
Composer 安装命令:
composer require hgists/lumener
包简介
Adminer/Adminer Editor for Lumen/Laravel 5.*
README 文档
README
Adminer is a full-featured database management tool written in PHP. This package integrates the adminer interface into your Lumen or Laravel project by acting as a wrapper and taking care of incompatibility issues. Lumener also provides means to update, stylize or extend adminer through the artisan commands.
This was initially forked from leung/laravel-adminer. The package was developed and tested using Lumen. So, Laravel support is untested (Although no changes should break it). Feel free to test on Laravel and open issues and/or submit a pull request!
Requirements
General
- guzzlehttp/guzzle
Lumen
- illuminate/cookie
- illuminate/session
Installation
# Install package composer require hgists/lumener # Download latest Adminer php artisan lumener:update # [Optional] Apply theme php artisan lumener:stylize
For Lumen or Laravel 5.4 or older, see the next section.
Provider
The provider will automatically create any required roots and enable the artisan commands.
Lumen
open your bootstrap/app.php and add this line anywhere before return $app;
$app->register(\Lumener\LumenerServiceProvider::class);
Laravel ≤ 5.4
Open your config/app.php and add this line in providers section
Lumener\LumenerServiceProvider::class
Laravel 5.5+
Auto package discovery should add the provider.
Config
You don't need to create a config file as all configuration parameters have a fallback value. You can follow the following instructions to customize the configuration.
- Create a
config/lumener.phpfile or usephp artisan vendor:publish(Laravel only) - For Lumen, you must also add the following line to
bootstrap/app.phpbeforereturn $app;
$app->configure('lumener');
Artisan Commands
Updating Adminer
php artisan lumener:update [OPTIONAL --force]
You can configure your composer.json to do this after each commit:
"scripts": { "post-install-cmd": [ "php artisan lumener:update" ], "post-update-cmd": [ "php artisan lumener:update" ] }
You can also create a route to update lumener with the action \Lumener\Controllers\LumenerController@update.
Themes
php artisan lumener:stylize [OPTIONAL --file] [OPTIONAL --url]
Default
If no arguments provided, this command will install the default theme already packed in with Lumener: Material Design for Adminer
php artisan lumener:stylize
For more themes, check the Adminer website.
File
php artisan lumener:stylize --file=/home/Downloads/adminer.css
URL
php artisan lumener:stylize --url=https://raw.githubusercontent.com/vrana/adminer/master/designs/lucas-sandery/adminer.css
For themes containing images/JavaScript you will have to copy the files manually to your public path.
Plugins
Install or update any plugin given its path or url.
php artisan lumener:plugin [OPTIONAL --file] [OPTIONAL --url]
Plugins must be enabled in config('lumener.adminer.plugins.enabled'). Refer to the config section.
Default
If no arguments provided, this command will install the plugin.php file which is required for any plugins to run.
php artisan lumener:plugin
File
php artisan lumener:plugin --file=/home/Downloads/designer.php
URL
php artisan lumener:plugin --url=https://raw.github.com/vrana/adminer/master/plugins/database-hide.php
Extensions
Adminer supports Extensions. In fact, Lumener takes advantage of quite a few extension functions. However, more extensions can be added using another user-defined class. This can be done all while preserving the original Lumener extensions, unless a conflict arises. Please take some time to check src/logic/adminer_object before writing your own extensions to be aware of potential conflicts.
To add your own extensions, set config('lumener.adminer.extension_file').
"adminer" => [ ... "extension_file" => base_path("app/Logic/LumenerExtension.php") ... ]
Example file:
<?php // Lumener and $plugins are already defined before this file is included class ExtendedLumener extends Lumener { function permanentLogin() { // key used for permanent login return 'ca41d8e9879df648e9a43cefa97bc12d'; } } if (empty($plugins)) { return new ExtendedLumener(); } return new ExtendedLumener($plugins);
Custom Route
You can modify route attributes in config('lumener.route').
Lumen Special
You may add a route to your own routes file (e.g. routes/web.php) with the name lumener and it will override all attributes, except for namespace.
$router->addRoute(null, 'lumener', ['middleware' => ['auth'], 'as' => 'lumener']);
This also works if you add the route inside an existing group.
$router->group( ['middleware' => ['encrypt_cookies', 'auth', 'level:100'], 'prefix' => 'admin'], function () use ($router) { $router->addRoute(null, 'lumener', ['as' => 'lumener']); } );
Using specific HTTP methods is not supported, please keep it null.
The route path and options here will override config('lumener.route').
Laravel Special
You can define a middleware group named lumener and it will be automatically used in the LumenerController.
Additionally, add the lumener route to $except to avoid CSRF issues
protected $except = [ 'lumener' ];
Embedding
The route can be redirected to a function in a user-defined controller. This is done by overriding the uses option either in config('lumener.route.options.uses') or in the user-defined route (Lumen).
The following code is a simple example of how embedding might work.
class AdminController{ public function __construct(Request $request) { $this->request = $request; } public function lumener() { // If you are using a Content Seucrity Policy, define it here define("LUMENER_CSP", [["form-action" => "'self'"]]); $controller = new \Lumener\Controllers\LumenerController($this->request); $content = $controller->index(); return view('admin.dashboard', ['content' => $content]); } } // Don't forget to use {!! $content !!} in blade as $content is HTML
Credits
License
The MIT License (MIT). Please see License File for more information.
hgists/lumener 适用场景与选型建议
hgists/lumener 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 163 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「themes」 「plugins」 「editor」 「extensions」 「laravel」 「adminer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hgists/lumener 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hgists/lumener 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hgists/lumener 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Themes
WordPress mu-plugin to register the theme directory for the default WordPress themes.
This is twig version of Flow Theme for OXID eShop.
Test theme for Altis DXP, based on Automattic/_s starter theme.
This is a Smarty version of Admin Theme for OXID eShop.
Adds more BBCode
统计信息
- 总下载量: 163
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-28