Skip to content

mablae/time-window-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TimeWindowBundle

This bundle implements implements basically daytime based feature flags.

NOTICE This bundle is the result of quickly decoupling some logic we already had duplicated in serveral places of an legacy codebase. If you are looking for a full featured Feature Toggle Bundle for Symfony you are probably better using https://github.com/qandidate-labs/qandidate-toggle-bundle

Feel free to contribute or leave feedback in the issues. <3

##Installation

Step 1: Install DatetimepickerBundle

php composer.phar require mablae/datetimepicker-bundle

Step 2: Enable the bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Mablae\TimeWindowBundle\MablaeTimeWindowBundle(),
    );
}

Step 3: Configure your named time windows:

# app/config/config.yml
mablae_time_window_:
    enabled: ~
    time_windows:
      in_the_morning:
        - { startTime : '06:00' , endTime: '08:00' }

At the moment there is no proper overlapping checks or sorting. The timewindow must be defined in correct order. The first timewindow that returns active wins.

Step 4: Use the voter service to ask, if a time-window is active

<?php 
/* ... */ 

$timeWindowService = $this->get('mablae_time_window.service');

$itsInTheMorning = $timeWindowService->isTimeWindowActive('in_the_morning')

About

A symfony feature flag bundle for time based feature flags

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages