Install Adminer In Laravel 8

  1277 views   5 months ago Laravel

When accessing database, command line access need skill and you need to write full query. You might needed GUI based database system. Either you can install Workbench, SQLPro database softwares or browser based like phpMyAdmin or Adminer.

Adminer is simple and lightweight database management tool written in PHP. It is simple one php file, so you can easily use and transport. Adminer can be used for MySQL, MongoDB, MariaDB, MS SQL, PostgreSQL, SQLite, Oracle and others databases using third party plugin. You can simply download and put the Adminer.php file in your server and access databases using file.

Suppose you want to access Adminer tool in your Laravel framework, then you can also integrate it using Laravel Adminer Database Manager. Here is few things to use Adminer in Laravel application.

First install package in Laravel application using Composer command.

composer require onecentlin/laravel-adminer

In config/app.php file, add the provider class in 'providers' array.

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

Now add adminer middleware group in app/Http/Kernel.php. You can add your custom middleware instead of Authenticate.

protected $middlewareGroups = [
    ...
    'adminer' => [
        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
        \Illuminate\Session\Middleware\StartSession::class,
        // use laravel default login or add your custom here
        \Illuminate\Auth\Middleware\Authenticate::class,
    ],
];

Publish the package configuration file using artisan command.

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

This will copy config/adminer.php and public/adminer.css file.

In config/adminer.php file, you can enable or disable autologin and set route_prefix.

<?php

return [
    'autologin' => false,
    'route_prefix' => 'adminer',
]

You can download theme and set it in public/adminer.css file.

Access adminer

In your browser, you can access Adminer using route.

http://example.com/adminer
Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]