alanmburr/laravel-adminer
最新稳定版本:v4.8.1
Composer 安装命令:
composer require alanmburr/laravel-adminer
包简介
Adminer (by Jakub Vrana) wrapper for Laravel 5+
README 文档
README
Laravel 10 wrapper for Adminer. Adminer is an excellent database management tool in a single PHP file written by Jakub Vrana. It's a great replacement for PhpMyAdmin (also supports PostgreSQL, SQLite, MSSQL, Oracle, Firebird, SimpleDB, Elasticsearch and MongoDB).
Note
This package was originally built for Laravel 5, so some information may be outdated. However, the package should still function properly.
Usage
To include the library, go to your project's folder and run:
composer require "alanmburr/laravel-adminer"
To add adminer to Laravel routes (e.g. /adminer), update routes/web.php file with:
Route::any('adminer', [\AlanMBurr\LaravelAdminer\AdminerController::class, 'index']);
To autologin Adminer with Laravel default connection, add the following controller instead:
Route::any('adminer', [\AlanMBurr\LaravelAdminer\AdminerAutologinController::class, 'index']);
Disabling CSRF Middleware
Adminer doesn't work with VerifyCsrfToken middleware, so it has to be disabled on its route.
Laravel 5.1+
In VerifyCsrfToken.php disable CSRF by adding adminer route to $except array:
protected $except = [ 'adminer' ];
Laravel 5.0
The easiest way is to create a custom VerifyCsrfToken middleware that excludes selected routes:
use Closure; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; class CustomVerifyCsrfToken extends VerifyCsrfToken { protected $excludedRoutes = ['adminer']; public function handle($request, Closure $next) { if ($this->isExcludedRoute($request)){ return $next($request); } else { return parent::handle($request, $next); } } private function isExcludedRoute($request) { if (count($request->segments()) > 0 && in_array($request->segment(1), $this->excludedRoutes)){ return true; } else { return false; } } }
And then use that instead of VerifyCsrfToken in Kernel.php
protected $middleware = [ 'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode', 'Illuminate\Cookie\Middleware\EncryptCookies', 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse', 'Illuminate\Session\Middleware\StartSession', 'Illuminate\View\Middleware\ShareErrorsFromSession', 'Path\To\CustomVerifyCsrfToken', ];
Remarks
Due to function name conflicts of Laravel5 and Adminer, adminer.php file functions 'cookie()', 'redirect()' and 'view()' are prefixed with 'adm_' prefix.
If you find any problem, please let me know.
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-14