2017 © Pedro Peláez
 

library zf2-opensoft-rollout

ZF2 module for the Opensoft Rollout library

image

adlogix/zf2-opensoft-rollout

ZF2 module for the Opensoft Rollout library

  • Tuesday, July 3, 2018
  • by toni.vdv
  • Repository
  • 3 Watchers
  • 4 Stars
  • 2,724 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 17 % Grown

The README.md

Zend Framework 2 Module - Rollout

Build Status Scrutinizer Code Quality Total Downloads License composer.lock Latest Stable Version, (*1)

A ZF2 Module for opensoft/rollout, (*2)

Installation

  1. Install the module via composer by running:
composer require adlogix/zf2-opensoft-rollout:~1.0
  1. Add the Adlogix\Zf2Rollout module to the module section of your config/application.config.php

Configuration

Rollout parameters can be defined in the application configurations:, (*3)

<?php
return [
    'rollout' => [

        // Service id to obtain a Opensoft\Rollout\RolloutUserInterface instance
        'user_service' => null,

        // Service id to obtain a Opensoft\Rollout\Storage\StorageInterface instance
        'storage_service' => 'zf2_rollout_storage_array',

        // Required configuration if storage service is Adlogix\Zf2Rollout\Storage\ZendDbAdapterStorage
        'zend_db_storage' => [
            'table_name' => 'rollout_feature'
        ],

        // Required configuration if storage service is Adlogix\Zf2Rollout\Storage\Doctrine\DoctrineORMStorage
        'doctrine_storage' => [
            'class_name' => SomeFeatureEntity::class
        ],

        // (Optional) Describes the features with a description
        'features' => [
            'feature_1' => [
                'description' => 'The description of the feature.' 
            ]
        ]
    ],
]

Usage

To retrieve the rollout service from a zend controller:, (*4)

<?php

$rollout = $this->getServiceLocator()->get('zf2_rollout');

Refer to the documentation of opensoft/rollout for more information on how to use the library., (*5)

Describe the features

Since the Rollout library doesn't have (yet) a functionality to describe its feature flags, you can define them through this module. To do so, simply add your feature flag identifier in the 'features' sections of the rollout configuration as shown here:, (*6)

<?php
return [
    'rollout' => [

        // (Optional) Describes the features with a description
        'features' => [
            'feature_1' => [
                'description' => '' 
            ]
        ]
    ],
];

To display the description in a view you have to call the view helper : rollout_description. If the description is not found in the configuration, an empty string will be returned., (*7)

echo $this->rollout_description('feature_1');

Zend Developer Toolbar

The module comes with support for the zend developer toolbar., (*8)

zf2-adlogix-rollout zend developer tools, (*9)

:warning: The ZDT rollout comes with a quick toggling action, allowing the user to quickly enable/disable a feature by clicking on one of the listed feature elements in the toolbar. Make sure to only authorise these actions in development mode. :warning:, (*10)

An example of enabling the end points with BjyAuthorize:, (*11)

<?php

// config/autoload/authorization.development.php

use Adlogix\Zf2Rollout\Service\Controller\RolloutController;

return [
    'bjyauthorize' => [

        'guards' => [

            // Add this if you are adding guards on controllers
            'BjyAuthorize\Guard\Controller' => [
                ['controller' => RolloutController::class, 'roles' => ['guest','user']],
            ],

            // Add this if you are adding guards on routes
            'BjyAuthorize\Guard\Route' => [
                ['route' => 'rollout_feature_toggle', 'roles' => ['guest','user']],
            ],
        ],

    ],
];

The Versions

15/11 2017

1.0.1

1.0.1.0 https://github.com/adlogix/zf2-opensoft-rollout

ZF2 module for the Opensoft Rollout library

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 flags feature feature flags

06/10 2016

1.0.0

1.0.0.0 https://github.com/adlogix/zf2-opensoft-rollout

ZF2 module for the Opensoft Rollout library

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 flags feature feature flags