bestit / laravel-flagception
Laravel driver for the bestit/flagception-sdk
dev-master
2018-06-29 11:17 UTC
Requires
- php: ^5.6||^7.0
- flagception/flagception: ^1.1
- illuminate/routing: 5.2.*|5.6.*
- illuminate/support: 5.2.*|5.6.*
- illuminate/view: 5.2.*|5.6.*
Requires (Dev)
- phing/phing: ^2.15
- phpunit/phpunit: ^5.5
- squizlabs/php_codesniffer: ^2.8
This package is auto-updated.
Last update: 2024-10-29 05:16:34 UTC
README
Feature toggle for laravel. Laravel provider for the flagception/flagception-sdk.
Installation and setup
Install it via composer:
composer require bestit/laravel-flagception
The package will automatically register itself.
If you are using Laravel 5.5 or higher this package will be auto-discovered. For earlier versions you have to register the service provider in your app.php:
// config/app.php 'providers' => [ // ... BestIt\LaravelFlagception\FlagceptionServiceProvider::class, ];
The core of this package is the config. To publish it run:
php artisan vendor:publish --provider="BestIt\LaravelFlagception\FlagceptionServiceProvider"
Basic usage
Define a feature in your config file:
// config/flagception.php return [ //... 'features' => [ 'feature_123' => [ 'active' => false, ], ], ];
Inject the FeatureManager where you need it:
class WelcomeController extends Controller { public function index(FeatureManager $featureManager) { if ($featureManager->isActive('feature_123')) { //do something } //... } }