{"id":18963785,"url":"https://github.com/opensoft/rollout","last_synced_at":"2025-05-16T11:03:54.375Z","repository":{"id":15686791,"uuid":"18424494","full_name":"opensoft/rollout","owner":"opensoft","description":"Feature switches or flags for PHP","archived":false,"fork":false,"pushed_at":"2022-10-13T14:56:03.000Z","size":42,"stargazers_count":253,"open_issues_count":7,"forks_count":36,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-04T09:02:34.042Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/opensoft.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}},"created_at":"2014-04-04T01:59:39.000Z","updated_at":"2023-11-25T18:42:22.000Z","dependencies_parsed_at":"2023-01-13T18:32:44.047Z","dependency_job_id":null,"html_url":"https://github.com/opensoft/rollout","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2Frollout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2Frollout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2Frollout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2Frollout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opensoft","download_url":"https://codeload.github.com/opensoft/rollout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518384,"owners_count":22084374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-11-08T14:21:40.573Z","updated_at":"2025-05-16T11:03:54.356Z","avatar_url":"https://github.com/opensoft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"rollout (for php)\n=================\n\n[![Build Status](https://travis-ci.org/opensoft/rollout.svg?branch=master)](https://travis-ci.org/opensoft/rollout) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/opensoft/rollout/badges/quality-score.png?s=a75edbc812e0b27279496e8f2f274f6a4c58dd9a)](https://scrutinizer-ci.com/g/opensoft/rollout/) [![Code Coverage](https://scrutinizer-ci.com/g/opensoft/rollout/badges/coverage.png?s=f2e7939ee89b8788df83bcc556aefedcf03cb6e4)](https://scrutinizer-ci.com/g/opensoft/rollout/)\n\nFeature flippers for PHP.  A port of ruby's [rollout](https://github.com/FetLife/rollout).\n\nInstall It\n----------\n\n    composer require opensoft/rollout\n\nHow it works\n------------\n\nInitialize a rollout object:\n\n```php\nuse Opensoft\\Rollout\\Rollout;\nuse Opensoft\\Rollout\\Storage\\ArrayStorage;\n\n$rollout = new Rollout(new ArrayStorage());\n```\n\nCheck if a feature is active for a particular user:\n\n```php\n$rollout-\u003eisActive('chat', $user);  // returns true/false\n```\n\nCheck if a feature is activated globally:\n\n```php\n$rollout-\u003eisActive('chat'); // returns true/false\n```\n\nStorage\n-------\n\nThere are a number of different storage implementations for where the configuration for the rollout is stored.\n\n* ArrayStorage - default storage, not persistent\n* DoctrineCacheStorageAdapter - requires [doctrine/cache][doctrine-cache]\n* PDOStorageAdapter - persistent using [PDO][pdo]\n* RedisStorageAdapter - persistent using [Redis][redis]\n* MongoDBStorageAdapter - persistent using [Mongo][mongo]\n\n[doctrine-cache]: https://packagist.org/packages/doctrine/cache\n[pdo]: http://php.net/pdo\n[redis]: http://redis.io\n[mongo]: http://mongodb.org\n\nAll storage adapters must implement `Opensoft\\Rollout\\Storage\\StorageInterface`.\n\nGroups\n------\n\nRollout ships with one group by default: `all`, which does exactly what it sounds like.\n\nYou can activate the `all` group for chat features like this:\n\n```php\n$rollout-\u003eactivateGroup('chat', 'all');\n```\n\nYou may also want to define your own groups.  We have one for caretakers:\n\n```php\n$rollout-\u003edefineGroup('caretakers', function(RolloutUserInterface $user = null) {\n  if (null === $user) {\n    return false;\n  }\n\n  return $user-\u003eisCaretaker(); // boolean\n});\n```\n\nYou can activate multiple groups per feature.\n\nDeactivate groups like this:\n\n```php\n$rollout-\u003edeactivateGroup('chat');\n```\n\nSpecific Users\n--------------\n\nYou may want to let a specific user into a beta test or something.  If that user isn't part of an existing group, you can let them in specifically:\n\n```php\n$rollout-\u003eactivateUser('chat', $user);\n```\n\nDeactivate them like this:\n\n```php\n$rollout-\u003edeactivateUser('chat', $user);\n```\n\nRollout users must implement the `RolloutUserInterface`.\n\nUser Percentages\n----------------\n\nIf you're rolling out a new feature, you may want to test the waters by slowly enabling it for a percentage of your users.\n\n```php\n$rollout-\u003eactivatePercentage('chat', 20);\n```\n\nThe algorithm for determining which users get let in is this:\n\n```php\ncrc32($user-\u003egetRolloutIdentifier()) % 100 \u003c $percentage\n```\n\nSo, for 20%, users 0, 1, 10, 11, 20, 21, etc would be allowed in. Those users would remain in as the percentage increases.\n\nDeactivate all percentages like this:\n\n```php\n$rollout-\u003edeactivatePercentage('chat');\n```\n\n**Note:** Activating a feature for 100% of users will also make it activate `globally`.  This is like calling `$rollout-\u003eisActive()` without a user object.\n\nFeature is Broken\n-----------------\n\nDeactivate everybody at once:\n\n```php\n$rollout-\u003edeactivate('chat');\n```\n\nYou may wish to disable features programmatically if monitoring tools detect unusually high error rates for example.\n\nRemove a Feature (added in 2.0.0)\n---------------------------------\n\nAfter a feature becomes mainstream or a failed experiment, you may want to remove the feature definition from rollout.\n\n```php\n$rollout-\u003eremove('chat');\n```\n\nNote: If there is still code referencing the feature, it will be recreated with default settings.\n\nSymfony2 Bundle\n---------------\n\nA Symfony2 bundle is available to integrate rollout into Symfony2 projects.  It can be found at http://github.com/opensoft/OpensoftRolloutBundle.\n\nZend Framework 2 Module\n-----------------------\n\nA Zend Framework 2 module is availabile to intergrate rollout into Zend Framwork 2 projects. It can be found at https://github.com/adlogix/zf2-opensoft-rollout.\n\nImplementations in other languages\n----------------------------------\n\n* Ruby: http://github.com/FetLife/rollout\n* Python: http://github.com/asenchi/proclaim\n\nCopyright\n---------\n\nCopyright © 2017 James Golick, BitLove, Inc. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensoft%2Frollout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopensoft%2Frollout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensoft%2Frollout/lists"}