enstart / db
maer/enstart 框架的数据库扩展
0.1.0
2017-07-01 13:08 UTC
Requires
- php: >=7.0
- mrjgreen/database: ^2.5
This package is not auto-updated.
Last update: 2024-09-25 01:26:59 UTC
README
为enstart框架包装mrjgreen/database。
依赖
enstart/core
版本 0.3+- PHP 7.0+ 且启用 PDO 扩展
安装
composer require enstart/db
配置
// Database connection settings
'database' => [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'database',
'username' => 'username',
'password' => 'password',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci'
],
// Register service provider
'providers' => [
...
'Enstart\Ext\Database\ServiceProvider',
],
访问扩展
// Get a copy of the instance
$db = $app->container->make('Database\Connection');
// or through the alias:
$app->db
// or through dependency injection (if you type hint it in your constructor)
use Database\Connection