Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onecentlin/laravel-adminer
Adminer database manager for Laravel 5+
https://github.com/onecentlin/laravel-adminer
adminer database-management laravel laravel-adminer laravel-package php
Last synced: 27 days ago
JSON representation
Adminer database manager for Laravel 5+
- Host: GitHub
- URL: https://github.com/onecentlin/laravel-adminer
- Owner: onecentlin
- License: mit
- Created: 2015-11-18T09:44:35.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-02T15:17:04.000Z (8 months ago)
- Last Synced: 2024-09-28T20:20:55.599Z (about 1 month ago)
- Topics: adminer, database-management, laravel, laravel-adminer, laravel-package, php
- Language: PHP
- Homepage:
- Size: 1.75 MB
- Stars: 241
- Watchers: 7
- Forks: 45
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Adminer Database Manager
Light weight [Adminer](https://www.adminer.org) database management tool integrated into Laravel 5/6/7/8/9.
Various database support: MySQL, SQLite, PostgreSQL, Oracle, MS SQL, Firebird, SimpleDB, MongoDB, Elasticsearch, and etc.
## 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:
```json
"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`
```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
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](https://www.adminer.org) 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:
```php
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`
```php
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
```php
return [
...
'plugins' => [
'PluginClassNameWithoutArguments',
'PluginClassNameWithArgument' => 'argument_value',
'PluginClassNameWithMultipleArguments' => ['arg1', 'arg2', ...],
],
];
```- [Adminer Plugins](https://www.adminer.org/en/plugins/)
## Access adminer
Open URL in web browser
```
http://[your.domain.com]/adminer
```![Screenshot](https://raw.githubusercontent.com/onecentlin/laravel-adminer/master/screenshots/adminer-db-support.png "various database support")
## 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](https://github.com/miroc/Laravel-Adminer)