定制 onecentlin/laravel-adminer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

onecentlin/laravel-adminer

Composer 安装命令:

composer require onecentlin/laravel-adminer

包简介

Laravel Adminer Database Manager

README 文档

README

Light weight Adminer database management tool integrated into Laravel 5 and above.

Various database support: MySQL, SQLite, PostgreSQL, Oracle, MS SQL, Firebird, SimpleDB, MongoDB, Elasticsearch, and etc.

v8.0 Update

  • Adminer update to v5.0.x (namespace added)

Notice: if you are using plugins, please check namespace with Adminer.

v7.2 Update

  • Laravel 12.x Compatibility
  • Adminer update to v4.17.1

v7.0 New Features

  • Laravel 11.x Compatibility
  • Adminer plugins support

v6.0 New Features

Make life easier with minimized package setup =)

  • Enable laravel auto package discovery
  • New config setting: middleware (default value: auth)
  • Enable env variables to setup adminer config
    • ADMINER_ENABLED
    • ADMINER_AUTO_LOGIN
    • ADMINER_ROUTE_PREFIX

Installation

composer require onecentlin/laravel-adminer

OR

Update composer.json in require section:

"require": {
    "onecentlin/laravel-adminer": "^7.0"
},

Run:

composer update onecentlin/laravel-adminer

Register package

Laravel auto package discovery feature added since package v6.0, you may skip this step.

Update config/app.php

'providers' => [
    ...
    Onecentlin\Adminer\ServiceProvider::class,
];

Publish config and theme file

php artisan vendor:publish --provider="Onecentlin\Adminer\ServiceProvider"

This action will copy two files and one folder:

  • config/adminer.php - Adminer config file
  • public/adminer.css - Adminer theme file
  • resources/plugins - Adminer plugins directory

config file: config/adminer.php

<?php

return [
    'enabled' => env('ADMINER_ENABLED', true),
    'autologin' => env('ADMINER_AUTO_LOGIN', false),
    'route_prefix' => env('ADMINER_ROUTE_PREFIX', 'adminer'),
    'middleware' => 'auth',
    'plugins' => [],
];

ATTENSION: Please only enable autologin with authenticated protection.

theme file: public/adminer.css

You may download adminer.css from Adminer or create custom style, and place it into public folder.

Setup Access Permission (Middleware)

Package v6.0 allow customized middleware config, you may skip this step or modify to fit your needs.

Laravel 11 middleware setup changes

Since Laravel v11 remove Kernel.php, the middleware setup point to bootstrap/app.php

Add your middleware group in withMiddleware section:

return Application::configure(basePath: dirname(__DIR__))
    ->withProviders()
    ->withRouting()
    ->withMiddleware(function (Middleware $middleware) {

        // [SETUP HERE] Adminer Middleware group
        $middleware->group('adminer', [
            \Illuminate\Cookie\Middleware\EncryptCookies::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\Auth\Middleware\Authenticate::class,
        ]);

    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();

Laravel 5.2 and above

Setup for middleware group supported for Laravel 5.2 above (~v10)

Modify config/adminer.php : 'middleware' => 'adminer',

Modify app/Http/Kernel.php file with adminer in $middlewareGroups

protected $middlewareGroups = [
    ...
    'adminer' => [
        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Session\Middleware\StartSession::class,
        // TODO: you may create customized middleware to fit your needs
        // example uses Laravel default authentication (default protection)
        \Illuminate\Auth\Middleware\Authenticate::class,
    ],
];

Enable Plugins

Drop your plugin files in resources/adminer/plugins

Modify config/adminer.php : 'plugins' => [] by adding the name of the plugin class and any argument required

return [
    ...
    'plugins' => [
        'PluginClassNameWithoutArguments',
        'PluginClassNameWithArgument' => 'argument_value',
        'PluginClassNameWithMultipleArguments' => ['arg1', 'arg2', ...],
    ],
];

Access adminer

Open URL in web browser

http://[your.domain.com]/adminer

Screenshot

Remarks

Due to function name conflicts of Laravel 5 and Adminer, adminer.php file functions cookie(), redirect() and view() are prefixed with adm_ prefix.

Inspired by miroc

onecentlin/laravel-adminer 适用场景与选型建议

onecentlin/laravel-adminer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 533.53k 次下载、GitHub Stars 达 261, 最近一次更新时间为 2015 年 11 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「database」 「mysql」 「sqlite」 「management」 「adminer」 「laravel5」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 onecentlin/laravel-adminer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 onecentlin/laravel-adminer 我们能提供哪些服务?
定制开发 / 二次开发

基于 onecentlin/laravel-adminer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 533.53k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 263
  • 点击次数: 29
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 261
  • Watchers: 6
  • Forks: 48
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-18