Skip to content

davispeixoto/FeatureToggler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Feature Toggle

This package provides a simple feature toggle mechanism for PHP applications.

Latest Stable Version Total Downloads Scrutinizer Code Quality Code Coverage Build Status SensioLabsInsight

Installation

The package can be installed via Composer by requiring the davispeixoto/featuretoggle package in your project's composer.json.

{
    "require": {
        "davispeixoto/featuretoggle": "~1.0"
    }
}

And running a composer update from your terminal:

php composer.phar update

Configuration

Just put your features into the config file, with their respective state (true or false):

return [
    'my_feature' => true,
    'my_other_feature' => [
        'pt_br' => true,
        'en_us' => true,
        'es_es' => false
    ],
    ...
];

Usage

That's it! You're all set to go. Just use:

    Davispeixoto\FeatureToggler\FeatureToggler;
    ...

    $toggler = new FeatureToggler('path/to/my_config_file.php');

    if($toggler->isEnabled('my_feature')) {
        // do the feature here
    }

    ...
    // for multidimensional config array
    if($toggler->isEnabled('my_other_feature.en_us')) {
        // new code here
    } else {
        // old code here
    }

License

This software is licensed under the MIT license

Versioning

This project follows the Semantic Versioning

Thanks

An amazing "Thank you, guys!" for Jetbrains folks, who kindly empower this project with a free open-source license for PhpStorm which can bring a whole new level of joy for coding.

Jetbrains

PhpStorm

About

PHP Feature Toggle library

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages