terabytesoft/db-mysql

Yii DataBase MySQL Extension

dev-main / 3.0.x-dev 2022-02-10 19:06 UTC

This package is auto-updated.

Last update: 2023-04-16 22:00:55 UTC


README

68747470733a2f2f796969736f66742e6769746875622e696f2f646f63732f696d616765732f7969695f6c6f676f2e737667 68747470733a2f2f6c6162732e6d7973716c2e636f6d2f636f6d6d6f6e2f6c6f676f732f6d7973716c2d6c6f676f2e737667

Yii DataBase MySQL Extension


This package provides MySQL extension for Yii DataBase library. It is used in Yii Framework but is supposed to be usable separately.

Latest Stable Version Total Downloads Scrutinizer Code Quality Code Coverage

Support version

PHP Mysql Version CI-Actions
7.4 - 8.0 5.7 - 8.0 Build status Mutation testing badge static analysis type-coverage

Installation

The package could be installed via composer:

composer require yiisoft/db-mysql

Configuration

Using 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'
    ]
];

Unit testing

The package is tested with PHPUnit. To run tests:

./vendor/bin/phpunit

Mutation testing

The package tests are checked with Infection mutation framework. To run it:

./vendor/bin/infection

Static analysis

The code is statically analyzed with Psalm. To run static analysis:

./vendor/bin/psalm

Support the project

Open Collective

Follow updates

Official website Twitter Telegram Facebook Slack

License

The 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.