marko/database-mysql
最新稳定版本:0.6.0
Composer 安装命令:
composer require marko/database-mysql
包简介
MySQL driver for Marko Framework Database Layer
README 文档
README
MySQL and MariaDB driver for the Marko framework database layer.
Installation
composer require marko/database-mysql
This automatically installs marko/database (the interface package) as a dependency.
Configuration
Publish or create config/database.php and set your connection details:
return [ 'default' => env('DB_CONNECTION', 'mysql'), 'connections' => [ 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'database' => env('DB_DATABASE', 'marko'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), ], ], ];
Set the corresponding values in your .env file:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_DATABASE=marko DB_USERNAME=root DB_PASSWORD=secret
Driver Notes
This driver supports MySQL 8.0+ and MariaDB 10.6+. Both are fully supported via the same driver key (mysql).
Quick Example
use Marko\Database\Connection\ConnectionInterface; class MyService { public function __construct( private ConnectionInterface $connection, ) {} public function doSomething(): void { $result = $this->connection->query('SELECT * FROM users'); } }
Documentation
Full configuration, driver notes, and API reference: marko/database-mysql
统计信息
- 总下载量: 52
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-24