Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sylius Feature Flag Bundle Plugin Laravel Package

em411/sylius-feature-flag-bundle-plugin

View on GitHub
Deep Wiki
Context7

Sylius FeatureFlag Bundle Plugin

CI License: MIT Latest Stable Version

Manage em411/feature-flag-bundle feature flags from the Sylius admin panel.

Tested on PHP 7.4 – 8.1 with Sylius 1.8+ on Symfony 4.4.

Feature flags become a Sylius resource: an admin can create, edit and delete them in a grid. Each flag has a code, an enabled toggle, an optional value and a description. A Doctrine-backed provider feeds the flags into the feature flag chain at a high priority, so a database flag overrides a code-defined feature (@AsFeature) of the same code.

Installation

composer require em411/sylius-feature-flag-bundle-plugin

1. Register the bundles

// config/bundles.php
return [
    // ...
    Ajgarlag\FeatureFlagBundle\FeatureFlagBundle::class => ['all' => true],
    Em411\SyliusFeatureFlagPlugin\Em411SyliusFeatureFlagPlugin::class => ['all' => true],
];

2. Import the admin routing

# config/routes/em411_sylius_feature_flag.yaml
em411_sylius_feature_flag_admin:
    resource: "@Em411SyliusFeatureFlagPlugin/Resources/config/routing/admin.yaml"
    prefix: /admin

3. Create the database table

The plugin ships the Doctrine mapping; generate and run a migration in your app:

bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate

4. Clear the cache

After installing or upgrading, clear the Symfony cache so the bundle's translations and grid config are picked up:

bin/console cache:clear

5. (BitBag ACL plugin only) grant the permission

If your project uses BitBagCommerce/SyliusAclPlugin (or a fork of it), open Configuration → Administrators → Roles, edit the role that should manage feature flags, and tick the Feature flag entries. Without this step the grid renders without Edit / Delete buttons because the ACL plugin filters out actions for routes the role hasn't been granted.

Usage

Open Configuration → Feature flags in the Sylius admin to manage flags.

Check a flag anywhere a FeatureCheckerInterface is available:

$featureChecker->isEnabled('my_flag');   // plain on/off flags
$featureChecker->getValue('my_flag');    // value-carrying flags

Enabling a feature for a group of users

The plugin is intentionally context-unaware. To target a group, store the group identifiers in the flag's value and check membership in your application — for example, a flag whose value is a comma-separated list of Sylius customer group codes:

$allowed = $featureChecker->getValue('beta_checkout');        // "wholesale,vip" or false
$groups  = false === $allowed ? [] : explode(',', $allowed);
$enabled = \in_array($customer->getGroup()->getCode(), $groups, true);

Configuration

# config/packages/em411_sylius_feature_flag_plugin.yaml
em411_sylius_feature_flag_plugin:
    provider_priority: 100   # priority of the DB provider in the feature flag chain

License

MIT.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums