Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Latest commit

 

History

History
56 lines (41 loc) · 1.84 KB

readme.md

File metadata and controls

56 lines (41 loc) · 1.84 KB

Feature switches in Laravel 4

Latest Stable Version Total Downloads Build Status

This package allows you to use feature switches in your code.

Installation

You can install this package trough Composer. Add this to your composer.json file:

"require": {
    // ...
    "ronaldvaneede/laravel-feature-switches": "dev-master"
}

Now run composer install or composer update to download it.

After that add the service provider to the providers array within the app/config/app.php file.

'providers' => array(
    // ...
    'Ronaldvaneede\Featureswitch\FeatureswitchServiceProvider',
)

That's it!

Using Feature switches

To use the feature switches you have to add this to the app/config/app.php file:

'features' => array(
    'feature-a' => array('enabled' => 'on'),
    'feature-b' => array('enabled' => 'off')
)

Then you can use Featureswitch::allow('feature-a') and Featureswitch::allow('feature-b') to check if the feature is available. The allow() method will return either true or false.

Wishes

In the end this should support a configuration like this:

// on / off / users -> user_list => 'a,b,c' / staff / 1%
'features' => array(
    'login' => array('enabled' => 'on'),
    'facebook' => array('enabled' => 'off'),
    'google+' => array('enabled' => '5%'),
    'twitter' => array('enabled' => 'users', 'user_list' => 'ronald,jaap,piet')
)