yii2-db-console The yii2 extension help to work in console with databases

db-console on Yii2

  1. Features
  2. Installation
  3. General Usage

Help you to work with different console database clients in unified format. Currently it support mysql, sqlite, postgres and mongodb drivers.


  • Open console database client.
  • Dump data into the destination.
  • Load data from file.
  • Restore data from the dump.

source: github


The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist dizews/yii2-db-console "*"

or add

"dizews/yii2-db-console": "*"

to the require section of your composer.json.

General Usage

'controllerMap' => [
        'db-console' => [
            'class' => 'dizews\dbConsole\DbController'
            //'drivers' => [
            //    'mysql' => [
            //        'class' => 'dizews\dbConsole\drivers\Mysql',
            //        'clientPath' => '/usr/local/bin/mysql'
            //    ]

Run database client (mysql)

Usually if you want to connect to a mysql server in terminal you need to write:

mysql --host= --port=3306 --user=user database --password=pwd

with this extension you just need: ~~~ php yii db-console ~~~

Run mongodb client

php yii db-console --name=mongodb
0 0
Yii Version: 2.0
License: BSD-2-Clause
Category: Console
Developed by: dizews
Created on: Jul 4, 2014
Last updated: 8 years ago

Related Extensions