kluvi/adminer-admin
Composer 安装命令:
composer require kluvi/adminer-admin
包简介
Ultimative administration powered by Adminer Editor with bindings to Laravel
README 文档
README
Adminer Admin is ultimative administration for any database. It is based on top of Adminer Editor from Jakub Vrána. Adminer Admin is available in many languages (same as Adminer Editor).
Adminer Admin is intended for your customers (when you makes some simple website for them) to edit content on their websites.
You:
- create blade templates
- write some CSS, JS,...
- prepare database tables with some comments (explained below)
- prepare apropriate Models
Your customer:
- just use Adminer Admin
Installation
composer require kluvi/adminer-admin- register provider
\kluvi\AdminerAdmin\Base\AdminerAdminServiceProvider::class,inconfig/app.php - edit
app/Http/Middleware/VerifyCsrfToken.phpmiddleware and add'/adminer-admin*'to$exceptarray (or your custom route fromconfig/adminer-admin.php) - run
php artisan vendor:publish --provider="kluvi\AdminerAdmin\Base\ServiceProvider" --tag=migrations, which publishes migrations - optionaly run
php artisan vendor:publish --provider="kluvi\AdminerAdmin\Base\ServiceProvider" --tag=config, which publishes config files (it is needed when you want to change default image uploads location) - run
php artisan migrate
Usage
Before first use, you must define comments in database (to tables and columns). Comments must be valid JSONs.
If table or column should be displayed, it must have at least {"name": "Column name"}. Other tables and columns are not displayed.
Columns
Most of columns are displayed as <input type="text" />. Some columns are different type, depending of default behaviour of Adminer Editor. Adminer Admin has some other types:
{"type": "image"}- allows upload image file and displays this image. It currently does not makes thumbnails of uploaded images. You must passbaseDirandbaseUrlwhich are used for storing and displaying images. Look intoconfig/adminer-admin.phpfor default values. Images are stored in directory{$baseDir}/{$tableName}/{$columnName}/{$primaryKeyValue}/{$uploadedFileName}- so table must have some primary key. Images can be uploded after saving the record (it needs to have primaryKeyValue){"type": "multi-input"}- allows storing multiple values as JSON array. Values are sortable and deletable. It's purpose is for storing for example product tags,...{"type": "password"}- password column. It stores passed password as password_hash(){"type": "readonly"}- this column is not editable. Just shows its value.
Adminer Admin also overrides some default behaviour of Adminer Editor in this cases:
- enum columns - it renders them as
<select> - foreign keys - it renders them as
<select>with names as{key column} - {column next to key column}- it is more readable for users
Tables
{"allowNew": false}- disables creating new rows in this table{"allowDelete": false}- disables deleting rows in this table
Other features
There is also one special table adminer_help. It has columns table and text. You can write some help text for your users there. This table is not directly viewable by users, but the content is rendered just after displaying table name.
Example
Example database is placed in examples/dump.sql. There is also index.php which demonstrates usage without Laravel.
How to use Adminer Admin without Laravel?
- look at Downloader->download() - this part is responsible for downloading and editing of Adminer Editor (there should be done some replacements) - you should somehow run it. The parameters are taken from
config/adminer-admin.php - use
AdminerFactory::run()in your controllers to run Adminer Admin. - now Adminer Admin should work - if not, please make an issue
<?php require "./vendor/autoload.php"; $downloadUrl = 'https://github.com/vrana/adminer/releases/download/v4.3.1/editor-4.3.1-mysql.php'; $targetDir = './adminer-download'; // Uncomment this to download a copy of Adminer Editor from URL above an apply some patches to downloaded file //$downloader = new \kluvi\AdminerAdmin\Base\Downloader; //$downloader->download($downloadUrl, $targetDir); $pluginsConfig = [ 'field_image' => [ 'baseDir' => './images/', 'baseUrl' => 'http://localhost/images/', ], ]; \kluvi\AdminerAdmin\Base\AdminerFactory::run($targetDir.'/adminer.php', $database = 'test', $host = 'localhost', $username = 'root', $password = '', $pluginsConfig);
Contribution
If you miss some feature or needs some help, please create an Issue.
kluvi/adminer-admin 适用场景与选型建议
kluvi/adminer-admin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 91 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 07 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kluvi/adminer-admin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kluvi/adminer-admin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 91
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: WTFPL
- 更新时间: 2017-07-03