mablae/time-window-bundle

Symfony时间特征开关的Bundle

安装次数: 2,810

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 2

分支: 0

开放性问题: 0

类型:symfony-bundle

v0.1.5 2016-05-27 01:55 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:58:29 UTC


README

此Bundle实现了基于白天的时间特征开关。

注意 此Bundle是快速解耦遗留代码库中重复逻辑的结果。如果您正在寻找一个完整的Feature Toggle Bundle for Symfony,您可能更愿意使用https://github.com/qandidate-labs/qandidate-toggle-bundle

请随意贡献或在此问题中留下反馈。 <3

##安装

步骤 1:安装DatetimepickerBundle

php composer.phar require mablae/datetimepicker-bundle

步骤 2:启用Bundle

<?php
// app/AppKernel.php

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

步骤 3:配置您的命名时间窗口

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

目前没有适当的重叠检查或排序。时间窗口必须按正确顺序定义。首先返回的活动时间窗口获胜。

步骤 4:使用投票服务询问时间窗口是否活动

<?php 
/* ... */ 

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

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