Download the PHP package featurit/featurit-sdk-laravel without Composer
On this page you can find all versions of the php package featurit/featurit-sdk-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download featurit/featurit-sdk-laravel
More information about featurit/featurit-sdk-laravel
Files in featurit/featurit-sdk-laravel
Informations about the package featurit-sdk-laravel
FeaturIT SDK for Laravel
Laravel wrapper of the PHP client for the FeaturIT Feature Flag management platform.
Description
This package aims to simplify the integration of the FeaturIT API in a Laravel project.
Getting started
Dependencies
- PHP >= 8.0.2
- laravel/framework >= 5.1
- psr/http-client-implementation
- psr/simple-cache-implementation
Installing
composer require featurit/featurit-sdk-laravel
If there's no package providing psr/http-client-implementation, visit https://packagist.org/providers/psr/http-client-implementation and choose the package that better suits your project.
If there's no package providing psr/simple-cache-implementation, visit https://packagist.org/providers/psr/simple-cache-implementation and choose the package that better suits your project.
Inside your config/app.php file, in the providers array add:
If you want to publish the default configuration file in order to customize things like the default FeaturitUserContextProvider, use the following command:
php artisan vendor:publish --provider="Featurit\Client\Laravel\FeaturitServiceProvider"
Basic Usage
That's how you would use Featurit in one of your controllers, services, or anywhere inside your PHP codebase:
Or in order to check which is the version of your feature:
Blade directives
For convenience we provide 3 blade directives which allow to load blade components depending on the Feature Flag values.
Inside your blade template, you can use them like this:
Defining your FeaturitUserContext
In order to show different versions of a feature to different users, Featurit needs to know about the attributes your user has in a certain context.
You can define the context using the as follows:
Defining a custom FeaturitUserContextProvider
This is an alternative to using Featurit::setUserContext(...);
.
By default, Featurit SDK for Laravel comes with a default FeaturitUserContextProvider in your config/featurit.php file
But you can create your own implementation in order to add custom attributes so they can be used in the segmentation process.
Let's say that your platform users have a "role" attribute that you use to decide which features you show to each user. In that case you could create an implementation like:
Then you must replace your implementation in the config/featurit.php file
And that should do it, from now on your segmentation rules will use the role attribute.
Authors
FeaturIT
All versions of featurit-sdk-laravel with dependencies
ext-json Version *
featurit/featurit-sdk-php Version ^0.8.0
illuminate/support Version ^5.1 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0