phputil/flags-pdo

phputil/flags 框架的基于PDO的存储

v0.1.3 2024-05-12 17:41 UTC

This package is auto-updated.

Last update: 2024-09-12 18:50:18 UTC


README

Version Build License PHP

phputil/flags 特性标志框架的基于PDO的存储phputil/flags

当前支持的驱动程序

  • sqlite
  • mysql

安装

需要PHP 7.4+和pdo扩展

composer require phputil/flags-pdo

⚠ 注意:您可能需要启用您想使用的PDO扩展。

例如,如果您想使用sqlite

  1. 找到您的php.ini文件

php --ini

  1. 打开您的php.ini并取消注释(或添加)以下行

extension=pdo_sqlite

用法

require_once 'vendor/autoload.php';

use phputil\flags\pdo\PDOBasedStorage;

$pdo = /* create you PDO instance here, e.g.: new PDO( 'sqlite:example.sqlite' ) */;
$storage = new PDOBasedStorage( $pdo );

// Now use it with phputil\flags
$flags = new phputil\flags\FlagManager( $storage );
...

许可

MIT © Thiago Delgado Pinto