PHPackages                             stogon/unleash-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. stogon/unleash-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

stogon/unleash-bundle
=====================

Unleash SDK implementation for Symfony framework

v1.0.1(4mo ago)1174.1k↓18.9%7[1 PRs](https://github.com/Stogon/unleash-bundle/pulls)MITPHPPHP ^8.1CI passing

Since May 2Pushed 4mo ago3 watchersCompare

[ Source](https://github.com/Stogon/unleash-bundle)[ Packagist](https://packagist.org/packages/stogon/unleash-bundle)[ RSS](/packages/stogon-unleash-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (25)Used By (0)

Unleash Bundle
==============

[](#unleash-bundle)

[![Packagist](https://camo.githubusercontent.com/443910f0c58f3a92b0b3f359654e483a486b141132c9d4ce258ef37bcf455623/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746f676f6e2f756e6c656173682d62756e646c652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/stogon/unleash-bundle)[![PHP from Packagist](https://camo.githubusercontent.com/fc3529ca6a14192e7bfa36837e69bc10b2f6683a4cf3e560870a0348d3b337c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73746f676f6e2f756e6c656173682d62756e646c652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/stogon/unleash-bundle)[![License](https://camo.githubusercontent.com/de00f3f716b6ad1f2503b484f62d3db82cefa1c9b5a2bd0004b19be23b59c5a7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f53746f676f6e2f756e6c656173682d62756e646c652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/stogon/unleash-bundle)[![codecov](https://camo.githubusercontent.com/3bd4b8dbc488c7101b61d29f0f22316530de4c2545e90f6466efcf97995931e0/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f53746f676f6e2f756e6c656173682d62756e646c652f6d61737465723f746f6b656e3d4e4936464d3054434d53267374796c653d666f722d7468652d6261646765)](https://codecov.io/gh/Stogon/unleash-bundle)

An [Unleash](https://docs.getunleash.io/) bundle for Symfony 6.4+ and 7.4+ applications.

This provide an easy way to implement **feature flags** using [Gitlab Feature Flags Feature](https://docs.gitlab.com/ee/operations/feature_flags.html).

This implementation conforms to the official [Unleash standards](https://github.com/Unleash/client-specification).

*Inspired by [minds/unleash-client-php](https://gitlab.com/minds/unleash-client-php) and [mikefrancis/laravel-unleash](https://github.com/mikefrancis/laravel-unleash).*

Installation
------------

[](#installation)

```
composer require stogon/unleash-bundle

```

Configurations
--------------

[](#configurations)

Full configurations example:

```
# config/packages/unleash.yaml
unleash:
    # The full URL to your unleash-server instance (must end with a slash).
    # Example with the "feature_flags" feature from Gitlab.com : https://gitlab.com/api/v4/feature_flags/unleash//
    api_url: 'https://gitlab.com/api/v4/feature_flags/unleash//'

    # Authorization key if needed
    auth_token: ''

    # Instance ID of your unleash application.
    # Example : VPQgqIdAxQyXY96d6oWj
    instance_id: ''

    # Unleash application name.
    # For Gitlab feature flags, it can be set to the environment name.
    # default: '%kernel.environment%'
    environment: '%kernel.environment%'

    cache:
        # Enable caching of features fetched from Unleash server.
        # default: true
        enabled: true
        # Service ID to use for caching (must be a cache pool)
        # default: '%unleach.cache.service%' (which resolve to '@cache.unleash.strategies' service)
        service: '@cache.app'
        # The period of time from the present after which the item MUST be considered expired in the cache in seconds
        # default: 15
        ttl: 15
```

Usage
-----

[](#usage)

To use the client, simply inject `Stogon\UnleashBundle\UnleashInterface` into your service and use it like this:

```
