dizews/yii2-db-console

The yii2 extension help to work in console with databases

Installs: 7 379

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 2

Open Issues: 0

Type:yii2-extension

1.0 2016-03-17 20:44 UTC

This package is auto-updated.

Last update: 2024-03-20 22:10:27 UTC


README

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

Total Downloads Code Climate

Features

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

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --dev --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=127.0.0.1 --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