phputil / flags-pdo
A PDO-based storage for the phputil/flags framework
v0.1.4
2024-11-09 21:33 UTC
Requires
- php: ^7.4 || ^8.0
- ext-pdo: *
Requires (Dev)
- ext-pdo_sqlite: *
- captainhook/captainhook: ^5.18
- friendsofphp/php-cs-fixer: ^3.35
- kahlan/kahlan: ^5.2
- phpstan/phpstan: ^1.10
- phputil/flags: ^0.4.0
- phputil/restage: ^0.3.0
README
A PDO-based storage for the phputil/flags feature flags framework
Currently supported drivers:
- sqlite
- mysql
Installation
Requires PHP 7.4+ and extension
pdo
composer require phputil/flags-pdo
⚠ Note: You may need to enable the PDO extension you want to use.
For instance, if you want to use sqlite
:
- Find your
php.ini
file:
php --ini
- Open your
php.ini
and uncomment (or add) the following line:
extension=pdo_sqlite
Usage
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 ); ...