Download the PHP package phputil/flags without Composer
On this page you can find all versions of the php package phputil/flags. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phputil/flags
More information about phputil/flags
Files in phputil/flags
Informations about the package flags
phputil/flags
🚩 A lightweight, customizable feature flags framework for PHP
You can customize:
- 🧠 How flags are evaluated, through Strategies.
- 💾 How flags are stored, through Storages.
- 📢 Who is notified about flag changes or removal, through Listeners.
Installation
PHP 7.4 or later. No external dependencies.
👉 You may also like to install some of the official extensions.
Extensions
Official extensions:
phputil/flags-pdo
- a PDO-based storage.- ⏳ SOON -
phputil/flags-firebase
- a Firebase-based storage. phputil/flags-webhooks
a listener that works like a webhook, by notifying external APIs about flags' changes.
Third-party extensions:
- Create yours and open an Issue to be evaluated. It may appear here.
Usage
Basic flag checking:
Customizing a certain verification:
Customizing all the verifications:
Setting a flag:
Removing a flag:
Retrieving flag data:
Adding a listener:
Customization
Storages
Use a different flag storage by:
- Creating your own, extending
FlagStorage
; OR - Using an external storage extension.
How to configure it:
Storages available in the framework:
InMemoryStorage
, that store flags in memory.
Strategies
Use a flag verification strategy by:
- Creating your own, extending
FlagVerificationStrategy
; OR - Using an external strategy extension.
How to configure it globally:
Strategies available in the framework:
StorageBasedVerificationStrategy
, that checks flags in a storage.EnvBasedVerificationStrategy
, that checks flags based on environment variables.
👉 A flag is considered enabled when all the strategies considered it enabled.
Listeners
Define a listener by:
- Creating your own, extending
FlagListener
; OR - Using an external listener extension.
How to configure it:
Roadmap
- [x] Extensible library
- [ ] Official extensions:
- [x] PDO-based storage
- [ ] Firebase-based storage
- [x] Webhook-like listener
- [ ] REST API (external repository)
- [ ] Web-based control panel (external repository)
License
Thiago Delgado Pinto