{"id":38345164,"url":"https://github.com/antfroger/progressive-bundle","last_synced_at":"2026-01-17T03:02:40.665Z","repository":{"id":56948757,"uuid":"326725712","full_name":"antfroger/progressive-bundle","owner":"antfroger","description":"The Symfony bundle for Progressive","archived":false,"fork":false,"pushed_at":"2024-02-08T20:50:31.000Z","size":134,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-29T21:39:37.047Z","etag":null,"topics":["feature-flag","feature-flags","feature-toggle","feature-toggles","symfony-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antfroger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-01-04T15:26:17.000Z","updated_at":"2022-03-15T07:13:09.000Z","dependencies_parsed_at":"2024-02-08T22:11:50.995Z","dependency_job_id":"8f0034da-052b-463b-a085-2a16837eda65","html_url":"https://github.com/antfroger/progressive-bundle","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"8611a46a97d036419d4011fe36ae141f8eca5418"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/antfroger/progressive-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfroger%2Fprogressive-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfroger%2Fprogressive-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfroger%2Fprogressive-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfroger%2Fprogressive-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antfroger","download_url":"https://codeload.github.com/antfroger/progressive-bundle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfroger%2Fprogressive-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28492593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T02:39:23.645Z","status":"ssl_error","status_checked_at":"2026-01-17T02:34:19.649Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["feature-flag","feature-flags","feature-toggle","feature-toggles","symfony-bundle"],"created_at":"2026-01-17T03:02:40.546Z","updated_at":"2026-01-17T03:02:40.622Z","avatar_url":"https://github.com/antfroger.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Progressive Bundle\n\nSymfony integration for the feature-flag library [Progressive](https://github.com/antfroger/progressive)\n\n[![Build Status](https://github.com/antfroger/progressive-bundle/workflows/CI/badge.svg)](https://github.com/antfroger/progressive-bundle)\n[![Latest stable version](https://poser.pugx.org/antfroger/progressive-bundle/v)](https://packagist.org/packages/antfroger/progressive-bundle \"Latest stable version\")\n\n## Installation\n\nInstall this bundle using Composer:\n\n```console\ncomposer require antfroger/progressive-bundle\n```\n\n## Configuration\n\n### 1. Enable the Bundle\n\nFirst, enable the bundle by adding it to the list of registered bundles\nin the `config/bundles.php` file of your project:\n\n```php\n// config/bundles.php\n\nreturn [\n    // ...\n    Af\\ProgressiveBundle\\AfProgressiveBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\n### 2. Configure the Bundle\n\nCreate the configuration file `config/packages/af_progressive.yaml`.\n\nThe only required key is `config`.\nThe key needs the path of the yaml file where you will configure the features of your application.  \nThe minimal configuration looks like this:\n\n```yaml\n# config/packages/af_progressive.yaml\naf_progressive:\n  config: '%kernel.project_dir%/config/features.yaml'\n```\n\nBut, you can also define under the `context` key, variables that will be stored in the [Contex object](https://github.com/antfroger/progressive#context-object).\n\n```yaml\n# config/packages/af_progressive.yaml\naf_progressive:\n  config: '%kernel.project_dir%/config/features.yaml'\n  context:\n    env: '%kernel.environment%'\n```\n\nThen, you need to create the file that will contain your features.  \nIt must contain at least the `features` key:\n\n```yaml\n# config/features.yaml\nfeatures: []\n```\n\nBut quickly, you can start adding many more features:  \n*(every time you change this file, you may need to clear the cache og your application: `php bin/console cache:clear`)*\n\n```yaml\n# config/features.yaml\nfeatures:\n  dark-theme: true\n  call-center:\n    between-hours:\n        start: 9\n        end: 19\n  homepage-v2:\n    partial:\n      env: ['dev', 'preprod']\n      roles: ['ROLE_ADMIN']\n  slack-message:\n    env: ['dev', 'preprod']\n  secret-feature:\n    users: ['antoine']\n  new-design:\n    unanimous:\n      env: ['dev', 'preprod']\n      roles: ['ROLE_DEV', 'ROLE_ADMIN']\n```\n\nLook at [Progressive documentation](https://github.com/antfroger/progressive#usage) to know more about the features' configuration.\n\n## Usage\n\nYou can use Progressive in a controller using [Symfony's autowiring](https://symfony.com/doc/current/service_container/autowiring.html):\n\n```php\n  public function info(Progressive $progressive): Response\n  {\n      if ($progressive-\u003eisEnabled('call-center')) {\n          // Do what you want when the feature `call-center` is enabled\n      }\n  }\n```\n\nOr in a template:\n\n```twig\n{% if is_enabled('call-center') %}\n    {# Do what you want when the feature `call-center` is enabled #}\n{% endif %}\n```\n\n## Rules\n\n### Built-in rules\n\nProgressive comes with several built-in rules:\n\n* `enabled: true|false`  \n[`enabled`](https://github.com/antfroger/progressive#enabled-truefalse) enables (or disables) the feature for everyone, everywhere, all the time.\n\n### Symfony specific rules\n\nThis bundle provides Symfony specific rules:\n\n* [`env: []`](#environments-)\n* [`roles: []`](#roles-)\n* [`users: []`](#users-)\n\n#### `env: []`\n\n`env` enables (or disables) the feature depending on the app environment.  \nThe value is meant to be an array of environment' names.\n\n```yaml\nfeatures:\n  send-slack-message:\n    env: ['dev', 'preprod']\n```\n\n#### `roles: []`\n\n`roles` only enables (or disables) the feature for specific roles.  \nThe value is meant to be an array of roles' names.\n\n*This example configuration enables the feature `new-amazing-homepage` only for admins and dev.*\n\n```yaml\nfeatures:\n  new-amazing-homepage:\n    roles: ['ROLE_ADMIN', 'ROLE_DEV']\n```\n\n#### `users: []`\n\n`users` is more fine-grained than `roles` because, it allows you to enable a feature at a user level.  \nThe value is meant to be an array of usernames.\n\n*This example configuration enables the feature `secret-feature` only for the users antoine and ted.*\n\n```yaml\nfeatures:\n  secret-feature:\n    users: ['antoine', 'ted']\n```\n\n### Create your own rules\n\nI'm sure that soon you will want to create your own rules to progressively enable features dependning on your application logic.  \nThat's where custom rules come into play! (More information about **custom rules** on the [Progressive doc](https://github.com/antfroger/progressive#custom))\n\nTo create your own rules and use them in your `feature. yaml` file, you only need to create a class extending `Progressive\\Rule\\RuleInterface`.  \nThat's it!  \nSymfony autowiring takes care of the rest.\n\nLet's say you want to display a chat in your contact page, but only in working hours (for instance between 9am and 7pm).\n\n1. First, create the rule:\n\n```php\n// src/Progressive/BetweenHours.php\nnamespace App\\Progressive;\n\nuse Progressive\\ParameterBagInterface;\nuse Progressive\\Rule\\RuleInterface;\n\nclass BetweenHours implements RuleInterface\n{\n    /**\n     * {@inheritdoc}\n     */\n    public function getName(): string\n    {\n        return 'between-hours';\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function decide(ParameterBagInterface $bag, array $hours = []): bool\n    {\n        if (!isset($hours['start']) || !is_int($hours['start']) || !isset($hours['end']) || !is_int($hours['end'])) {\n            return false;\n        }\n\n        $now = new \\DateTime();\n        $hour = $now-\u003eformat('H');\n        return $hours['start'] \u003c= $hour \u0026\u0026 $hour \u003c $hours['end'];\n    }\n}\n```\n\n2. Now, you can use this new rule, in the `feature. yaml` file\n\n```yaml\nfeatures:\n  customer-service-chat:\n    between-hours: # same as `BetweenHours::getName()`\n      start: 9\n      end: 19\n\n```\n\n3. You now have a feature using this new rule.  \nLet's use it in a controller or in a template:\n\n```php\npublic function customerService(Progressive $progressive): Response\n  {\n      if ($progressive-\u003eisEnabled('customer-service-chat')) {\n        // ...\n      }\n  }\n```\n\n```twig\n{% if is_enabled('customer-service-chat') %}\n    {# Display the chat #}\n{% endif %}\n```\n\n### Strategies\n\nThanks to strategies, you can combine the power of rules.  \nLet's say you want to enable your new feature `one-click-payment`:\n\n* for everyone in dev and preprod...\n* but only for admins in prod...\n* and two beta-testers (antoine and laurent).\n\nThis configuration will do the job:\n\n```yaml\nfeatures:\n  one-click-payment:\n    partial:\n      env: ['dev', 'preprod']\n      roles: ['ROLE_ADMIN']\n      users: ['antoine', 'laurent']\n```\n\nProgressive comes with two built-in rules:  \n(but as they simply are nested rules, you can create your own [strategies](https://github.com/antfroger/progressive/blob/main/README.md#strategies)!)\n\n* `unanimous: []`  \n[`unanimous`](https://github.com/antfroger/progressive#unanimous-) is a strategy (a combinaison of several rules). It enables the feature if all the conditions are met / if all the rules are true.\n* `partial: []`  \n[`patial`](https://github.com/antfroger/progressive#partial-) is also a strategy. It enables the feature if only one of the conditions is met / if at least one of the rules is true.\n\n## Commands\n\n### `progressive:features`\n\nThe command `progressive:features` lists all the features configured in Progressive:\n\n```bash\n  $ php bin/console progressive:features\n  Available features:\n    dark-theme\n    homepage-v2\n    customer-service-chat\n```\n\nIf you specify the name of the feature, its configuration will be displayed:\n\n```bash\n  $ php bin/console progressive:features dark-theme\n  Name:\n    dark-theme\n\n  Config:\n    unanimous:\n      env: dev, preprod\n      roles: ROLE_DEV\n```\n\n### `progressive:rules`\n\nThe command `progressive:rules` lists the rules provided by Progressive:\n\n```bash\n  $ php bin/console progressive:rules\n  Available rules:\n    enabled\n    env\n    partial\n    roles\n    unanimous\n    users\n```\n\n## Web toolbar \u0026 profiler\n\nIn order to have an quick and easy access to the available features of your application - and see which ones are enabled for you -\nSymfony's web toolbar includes a tab with your defined features.\n\n![web toolbar](./_images/web-toolbar.png)\n\nSymfony's profiler also includes a tab listing all the features of the application and their respective configuration.\n\n![profiler](./_images/profiler.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantfroger%2Fprogressive-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantfroger%2Fprogressive-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantfroger%2Fprogressive-bundle/lists"}