ItSolutionStuff.com

How to install Adminer with PHP Laravel?

By Hardik Savani • May 14, 2024
PHP Laravel

Today, i am going to share with you how to install adminer in laravel 5, laravel 6, laravel 7, laravel 8, laravel 9, laravel 10 and laravel 11 application. As we know adminer is similar like phpmyadmin. So if you want to install adminer in your server then follow bellow step and get full example for installation of adminer in laravel framework.

Preview:

Install Package

In this step we have to laravel-adminer package for adminer so one your cmd or terminal and fire bellow command:

composer require onecentlin/laravel-adminer

After successfully install package, open config/app.php file and add service provider and alias.

config/app.php

'providers' => [

....

Onecentlin\Adminer\ServiceProvider::class,

],

we have to also make public configuration file by following command. So run bellow command:

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

Middleware Configuration

here we will make configuration as listed files. So just configure listed files:

app/Http/Middleware/VerifyCsrfToken.php

<?php


namespace App\Http\Middleware;


use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;


class VerifyCsrfToken extends Middleware

{

/**

* The URIs that should be excluded from CSRF verification.

*

* @var array

*/

protected $except = [

'adminer'

];

}

app/Http/Kernel.php

<?php


namespace App\Http;


use Illuminate\Foundation\Http\Kernel as HttpKernel;


class Kernel extends HttpKernel

{

/**

* The application's global HTTP middleware stack.

*

* These middleware are run during every request to your application.

*

* @var array

*/

protected $middleware = [

.....

];


/**

* The application's route middleware groups.

*

* @var array

*/

protected $middlewareGroups = [

......

'api' => [

'throttle:60,1',

'bindings',

],

'adminer' => [

\App\Http\Middleware\EncryptCookies::class,

\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,

\Illuminate\Session\Middleware\StartSession::class,

// you may create customized middleware to fit your needs

\Illuminate\Auth\Middleware\Authenticate::class,

],

];


/**

* The application's route middleware.

*

* These middleware may be assigned to groups or used individually.

*

* @var array

*/

protected $routeMiddleware = [

.....

'adminer' => \App\Http\Middleware\Authenticate::class,

];

}

Run Project

Ok, now we are ready to run this example so quick run by following command:

php artisan serve

Now open your browser and run bellow link:

http://localhost:8000/adminer

I hope it can help you...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

Laravel US State Seeder Example

Read Now →

Laravel Seeder from CSV File Example

Read Now →

How to Run Specific Seeder in Laravel?

Read Now →

How to Run Migration and Seeder on Laravel Vapor?

Read Now →

How to Change Column Length using Laravel Migration?

Read Now →

Laravel Blade @includeWhen and @includeUnless Example

Read Now →

Laravel Blade Include File If Exists Example

Read Now →

Laravel CURL Request Example using Ixudra/curl

Read Now →

Laravel - How to generate RSS Feed using roumen/feed package?

Read Now →

Laravel Image Resize & Upload with Intervention Image Example

Read Now →

Laravel Login with Twitter OAuth Tutorial

Read Now →

Laravel Login with Google Account Tutorial

Read Now →

Laravel Facebook authentication using Socialite Package

Read Now →

How to Generate Dynamic Sitemap in Laravel?

Read Now →

Laravel Database Backup using Laravel Backup Package

Read Now →