flagception/database-activator
Larablocks Analysis
flagception/database-activator works with any PHP project: the latest release (2.0.0, Feb 27, 2025) doesn't depend on Laravel.
Recommendation checks
Use with careUse with care: meets 1 of 3 checks.
- No release in the last 12 months (last: Feb 27, 2025)
- 13,846 downloads a month (at least 10,000)
- 2 GitHub stars (needs 100)
State
Quiet- Last stable release: Feb 27, 2025.
- No releases in the last 12 months.
- First released: Jul 11, 2018.
- Monthly downloads: 13,846, up 33% from six months ago.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.
| Install | |
|---|---|
composer require flagception/database-activator |
|
| Latest Version: | 2.0.0 |
| PHP: | ^7.4 || ^8.0 |
| License: | MIT |
| Last Updated: | Feb 27, 2025 |
| Links: | GitHub · Packagist |
Database activator for flagception
Manage feature flags for Flagception with a sql database (mysql, postgres, sqlite, ...)!
Download the library
Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:
$ composer require flagception/database-activator
Usage
Just create a new DatabaseActivator instance and commit it to your feature manager:
// YourClass.php
class YourClass
{
public function run()
{
$activator = new DatabaseActivator('pdo-mysql://user:secret@localhost/mydb');
$manager = new FeatureManager($activator);
if ($manager->isActive('your_feature_name')) {
// do something
}
}
}
Connection
This activator use dbal under the hood. We redirect the first argument directly to dbal - so you can use all known connection options (see documentation):
User and password
// YourClass.php
class YourClass
{
public function run()
{
$activator = new DatabaseActivator([
'dbname' => 'mydb',
'user' => 'user',
'password' => 'secret',
'host' => 'localhost',
'driver' => 'pdo_mysql'
]);
// ...
}
}
Connection string
// YourClass.php
class YourClass
{
public function run()
{
$activator = new DatabaseActivator('pdo-mysql://user:secret@localhost/mydb');
// ...
}
}
DBAL instance
// YourClass.php
class YourClass
{
public function run()
{
$activator = new DatabaseActivator($this->myDbalInstance);
// ...
}
}
Table
The activator will create the sql table if it does not already exist. The default table name is flagception_features which contains
a feature and a state column. You can change the table and columns names by the second argument. It expects
an array with values for db_table, db_column_feature and db_column_state. Setting one of the fields in optional.
Example:
// YourClass.php
class YourClass
{
public function run()
{
$activator = new DatabaseActivator('pdo-mysql://user:secret@localhost/mydb', [
'db_table' => 'my_feature_table',
'db_column_feature' => 'foo_feature_name',
'db_column_state' => 'foo_is_active'
]);
// The activator create a table 'my_feature_table' with the column 'foo_feature_name' and 'foo_is_active'.
$manager = new FeatureManager($activator);
if ($manager->isActive('your_feature_name')) {
// do something
}
}
}
Alternatives to flagception/database-activator
Powerful PHP database abstraction layer (DBAL) with many features for database s...
A set of extensions to Doctrine that add support for json query functions.
💾 Nette Database: a database layer with SQL and smart placeholders, plus Explor...
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 2.0.0 | ^7.4 || | MIT | |
| 1.1.4 | ^7.1.3 || | MIT | |
| 1.1.3 | ^7.1.3 || | MIT | |
| 1.1.2 | ^7.1.3 | | MIT | |
| 1.1.1 | ^7.3|| | MIT | |
| 1.1.0 | ^7.3|| | MIT | |
| 1.0.0 | ^5.6|| | MIT |