Laravel-flipt was created by, and is maintained by Andrew Nagy, the package is designed to allow Laravel to work with Flipt
- Registers as a driver for Laravel Pennant
- Registers a Flipt client class to access the API directly
- Utilizes Laravel's cache system to store flags in cache for quick access with configurable TTL
Requires PHP 8.4+
Require Laravel-flipt using Composer:
composer require clearlyip/laravel-flipt
Laravel | Laravel Flipt |
---|---|
12.x | 1.x |
- Publish the Laravel Flipt configuration file using the
vendor:publish
Artisan command. Theflipt
configuration file will be placed in yourconfig
directory (Use--force
to overwrite your existingclearly
config file):php artisan vendor:publish --tag="flipt" [--force]
All options are fully documented in the configuration file
Register the driver for Laravel Pennant in the pennant.php
configuration file
'default' => env('PENNANT_STORE', 'flipt'),
'stores' => [
'array' => [
'driver' => 'array',
],
'flipt' => [
'driver' => 'flipt',
],
],
Use the hasFeatures trait on your User model
Configure what parameters to use for entityId and context in the flipt configuration file
'identity' => [
'identifier' => 'id',
'context' => [
'email' => 'email',
'my-value' => 'dot.notation.is.supported',
],
],
The Flipt Class can be accessed through Laravel's Container. The returned class is https://github.com/clearlyip/laravel-flipt
$flipt = App::make(Flipt::class);