{"id":13616915,"url":"https://github.com/qandidate-labs/qandidate-toggle-bundle","last_synced_at":"2026-03-17T20:03:10.757Z","repository":{"id":20381505,"uuid":"23657117","full_name":"qandidate-labs/qandidate-toggle-bundle","owner":"qandidate-labs","description":"Symfony Bundle for Qandidate\\Toggle","archived":false,"fork":false,"pushed_at":"2023-09-11T07:55:11.000Z","size":127,"stargazers_count":89,"open_issues_count":2,"forks_count":27,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-01-02T09:23:34.522Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qandidate-labs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-09-04T09:53:10.000Z","updated_at":"2024-03-21T09:18:57.000Z","dependencies_parsed_at":"2024-01-19T11:22:38.651Z","dependency_job_id":null,"html_url":"https://github.com/qandidate-labs/qandidate-toggle-bundle","commit_stats":{"total_commits":101,"total_committers":20,"mean_commits":5.05,"dds":"0.48514851485148514","last_synced_commit":"68bc9b81996c8fc4c8d47fa3a560e56b0af5272b"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/qandidate-labs/qandidate-toggle-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qandidate-labs%2Fqandidate-toggle-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qandidate-labs%2Fqandidate-toggle-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qandidate-labs%2Fqandidate-toggle-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qandidate-labs%2Fqandidate-toggle-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qandidate-labs","download_url":"https://codeload.github.com/qandidate-labs/qandidate-toggle-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qandidate-labs%2Fqandidate-toggle-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30630031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: 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":[],"created_at":"2024-08-01T20:01:34.741Z","updated_at":"2026-03-17T20:03:10.739Z","avatar_url":"https://github.com/qandidate-labs.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Qandidate Toggle Symfony Bundle\n\nThis Bundle provides the integration with [our toggle library]. It provides the\nservices and configuration you need to implement feature toggles in your\napplication.\n\n![build status](https://github.com/qandidate-labs/qandidate-toggle-bundle/actions/workflows/ci.yml/badge.svg)\n\n[our toggle library]: https://github.com/qandidate-labs/qandidate-toggle\n\n## About\n\nRead the our blog post series about this repository at:\n- http://labs.qandidate.com/blog/2014/08/18/a-new-feature-toggling-library-for-php/\n- http://labs.qandidate.com/blog/2014/08/19/open-sourcing-our-feature-toggle-api-and-ui/\n\n## Installation\n\n### Using Symfony Flex\n\nThe easiest way to install and configure the QandidateToggleBundle with Symfony is by using\n[Symfony Flex](https://github.com/symfony/flex).\n\nMake sure you have Symfony Flex installed:\n\n```\n$ composer require symfony/flex ^1.0\n$ composer config extra.symfony.allow-contrib true\n```\n\nInstall the bundle:\n\n```\n$ composer require qandidate/toggle-bundle ^1.0\n```\n\nSymfony Flex will automatically register and configure the bundle.\n\n### Manually\n\nAdd the bundle to your composer.json\n\n```bash\n$ composer require qandidate/toggle-bundle ^1.0\n```\n\nAdd the bundle to your Kernel:\n\n```php\n$bundles = array(\n    // ..\n    new Symfony\\Bundle\\SecurityBundle\\SecurityBundle(),\n    new Symfony\\Bundle\\TwigBundle\\TwigBundle(),\n    new Qandidate\\Bundle\\ToggleBundle\\QandidateToggleBundle(),\n);\n```\n\n## Configuration\n\n```yaml\nqandidate_toggle:\n    persistence: in_memory|redis|factory|config\n    context_factory: null|your.context_factory.service.id\n    redis_namespace: toggle_%kernel.environment% # default, only required when persistence = redis\n    redis_client: null|your.redis_client.service.id # only required when persistence = redis\n    collection_factory: # only required when persistence = factory\n        service_id: your.collection_factory.service.id\n        method: create\n```\n\n## Sample Configuration for Symfony\n\n```yaml\nqandidate_toggle:\n    persistence: config\n    toggles:\n      always-active-feature:\n        name: always-active-feature\n        status: always-active\n      inactive-feature:\n        name: inactive-feature\n        status: inactive\n        conditions: \n      conditionally-active:\n        name: conditionally-active\n        status: conditionally-active\n        conditions:\n         - name: operator-condition\n           key: user_id\n           operator:\n               name: greater-than\n               value: 42\n```\n\n## Example usage\n\nUsage can vary on your application. This example uses the supplied\n`UserContextFactory`, but you probably need to create your own factory.\n\n```xml\n\u003c!-- services.xml --\u003e\n\n\u003cservice id=\"acme.controller\" class=\"Acme\\Controller\"\u003e\n    \u003cargument type=\"service\" id=\"qandidate.toggle.manager\" /\u003e\n    \u003cargument type=\"service\" id=\"qandidate.toggle.user_context_factory\" /\u003e\n\u003c/service\u003e\n```\n\n```php\n// Acme\\Controller\n\npublic function __construct(\n    /* ArticleRepository, Templating, ..*/ \n    ToggleManager $manager, \n    ContextFactory $contextFactory\n) {\n    // ..\n    $this-\u003emanager = $manager;\n    $this-\u003econtext = $contextFactory-\u003ecreateContext();\n}\n\n// ..\n\npublic function articleAction(Request $request)\n{\n    $this-\u003earticle = $this-\u003erepository-\u003efindBySlug($request-\u003erequest-\u003eget('slug'));\n\n    return $this-\u003etemplating-\u003erender('article.html.twig', array(\n        'article'        =\u003e $article,\n        'enableComments' =\u003e $this-\u003emanager-\u003eactive('comments', $this-\u003econtext),\n    ));\n}\n```\n\nYou can find a working example using the Symfony [MicroKernelTrait](https://symfony.com/doc/current/configuration/micro_kernel_trait.html)\nin the [Resources/doc/example](https://github.com/qandidate-labs/qandidate-toggle-bundle/tree/master/Resources/doc/example) directory.\n\n## Annotation Usage\n\nYou can also use the `@Toggle` annotation on a controller. When the toggle isn't active a 404 exception is thrown.\n\n```php\nuse Qandidate\\Bundle\\ToggleBundle\\Annotations\\Toggle;\n\n/**\n * @Toggle(\"cool-feature\")\n */\nclass FooController\n{\n\n    /**\n     * @Toggle(\"another-cool-feature\")\n     */\n    public function barAction()\n    {\n    }\n\n    public function bazAction()\n    {\n    }\n}\n```\n\n## Twig usage\n\nIf you use Twig you can also use the function:\n\n```jinja\n{% if feature_is_active('comments') %}\n    {# Awesome comments #}\n{% endif %}\n```\nOr the Twig test:\n\n```jinja\n{% if 'comments' is active feature %}\n    {# Awesome comments #}\n{% endif %}\n```\n\nBoth are registered in the [ToggleTwigExtension](Twig/ToggleTwigExtension.php).\n\n## Data collector\n\nWith the data collector you have a overview about all toggles. In the toolbar you see all conditions and the current status. \n\nIn the panel you have two lists:\n\n* You can see all keys and there current values.\n* Then you can see all configured toggles, there conditions and if they are active.\n\n## Testing\n\nTo run PHPUnit tests:\n\n```bash\n$ ./vendor/bin/phpunit\n```\n\n## License\n\nMIT, see LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqandidate-labs%2Fqandidate-toggle-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqandidate-labs%2Fqandidate-toggle-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqandidate-labs%2Fqandidate-toggle-bundle/lists"}