arrowphp/database

为Arrow添加数据库支持。

v0.1.20190203 2019-02-03 06:07 UTC

This package is not auto-updated.

Last update: 2024-09-20 00:56:27 UTC


README

Software License

这是Arrow数据库插件。它为任何由Arrow驱动的应用程序添加数据库功能。

安装

通过项目composer.json文件

  "require": {
    "arrowphp/arrow": "@dev",
    "arrowphp/database": "@dev"
  }

用法

// Get the PDO instance of the default database connection
$pdo = $container->get(\Arrow\Database\Constant::CONTAINER_DATABASE());
// or get the PDO instance by config name
$pdo = $container->get(\Arrow\Database\Constant::CONTAINER_DATABASE('legacy-db'));

实现

更新现有的config.php文件或添加一个新的配置文件config.database.php,并使用以下配置进行更新。


return [
    'package' => [
        'arrowphp/database' => [
            'Connections' => [
                'default' => [
                    // For more information on dsn, see https://phpdelusions.net/pdo#dsn
                    'dsn' => '<dsn>',
                    'user' => '<user>',
                    'password' => '<password>',
                    'attributes' => [
                        // eg \PDO::ATTR_PERSISTENT => true,
                    ],
                ],
            ],
        ],
    ],
];

变更日志

有关最近更改的更多信息,请参阅变更日志

贡献

请参阅贡献指南行为准则以获取详细信息。

安全

如果您发现任何与安全相关的问题,请直接联系Chris Pennycuick,而不是使用问题跟踪器。

致谢

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。