maer/enstart 框架的数据库扩展

0.1.0 2017-07-01 13:08 UTC

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

更多信息请访问 https://github.com/mrjgreen/database