#DB Console
DB Console is a database console with support for Mysql
, Sqlite
, Mongodb
and Redis
.
Mysql:
MongoDB:
Redis:
composer require encore/dbconsole --dev
See database.php.
<?php
require __DIR__ . '/vendor/autoload.php';
use Encore\Dbconsole\Shell;
$shell = new Shell(__DIR__ . '/config/database.php');
// Also you can specify a connection which in your configuration.
//$shell->setConnection('redis');
$shell->run();
And run this script in your console.
When use in Laravel
, it will use the database configuration in application.
Add service provider to config/app.php
in providers
section:
Encore\Dbconsole\Providers\LaravelServiceProvider::class
then run DB Console
with:
php artisan db:console