This package provides MySQL extension for Yii DataBase library. It is used in Yii Framework but is supposed to be usable separately.
| PHP | Mysql Version | CI-Actions |
|---|---|---|
| 7.4 - 8.0 | 5.7 - 8.0 |
The package could be installed via composer:
composer require yiisoft/db-mysqlUsing yiisoft/composer-config-plugin automatically get the settings of Yiisoft\Cache\CacheInterface::class, LoggerInterface::class, and Profiler::class.
Di-Container:
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Mysql\Connection as MySqlConnection;
return [
ConnectionInterface::class => [
'class' => MySqlConnection::class,
'__construct()' => [
'dsn' => $params['yiisoft/db-mysql']['dsn'],
],
'setUsername()' => [$params['yiisoft/db-mysql']['username']],
'setPassword()' => [$params['yiisoft/db-mysql']['password']],
],
];Params.php
use Yiisoft\Db\Connection\Dsn;
return [
'yiisoft/db-mysql' => [
'dsn' => (new Dsn('mysql', '127.0.0.1', 'yiitest', '3306'))->asString(),
'username' => 'root',
'password' => 'root'
]
];The package is tested with PHPUnit. To run tests:
./vendor/bin/phpunitThe package tests are checked with Infection mutation framework. To run it:
./vendor/bin/infectionThe code is statically analyzed with Psalm. To run static analysis:
./vendor/bin/psalmThe Yii DataBase MySQL Extension is free software. It is released under the terms of the BSD License.
Please see LICENSE for more information.
Maintained by Yii Software.



