Skip to content

Commit c4b3264

Browse files
authored
add ZDT support (#2)
This PR adds support for the zend developer tools. While adding this, some refactoring were applied. But nothing (should) introduces BC breaks.
1 parent 415cd3e commit c4b3264

36 files changed

+454
-5388
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
2+
composer.lock
23
vendor

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ language: php
33
php:
44
- 5.6
55
- 7.0
6+
- 7.1
7+
- 7.2
8+
9+
matrix:
10+
allow_failures:
11+
- php: 7.2
612

713
cache:
814
directories:
915
- $HOME/.composer/cache
1016

1117
before_script:
12-
- composer install --dev --prefer-source
18+
- composer install
1319

1420
script:
15-
- vendor/bin/phpunit --configuration tests/phpunit.xml
21+
- vendor/bin/phpunit --configuration phpunit.dist.xml

Module.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,8 @@
1818
use Zend\ModuleManager\Feature\ViewHelperProviderInterface;
1919
use Zend\ServiceManager\AbstractPluginManager;
2020

21-
class Module implements AutoloaderProviderInterface, ConfigProviderInterface, ViewHelperProviderInterface
21+
class Module implements ConfigProviderInterface, ViewHelperProviderInterface
2222
{
23-
24-
/**
25-
* {@inheritdoc}
26-
*/
27-
public function getAutoloaderConfig()
28-
{
29-
return array(
30-
'Zend\Loader\StandardAutoloader' => array(
31-
'namespaces' => array(
32-
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
33-
),
34-
),
35-
);
36-
37-
}
38-
3923
/**
4024
* {@inheritdoc}
4125
*/

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,60 @@ Zend Framework 2 Module - Rollout
33

44
[![Build Status](https://travis-ci.org/adlogix/zf2-opensoft-rollout.svg?branch=master)](https://travis-ci.org/adlogix/zf2-opensoft-rollout) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/adlogix/zf2-opensoft-rollout/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/adlogix/zf2-opensoft-rollout/?branch=master) [![Total Downloads](https://poser.pugx.org/adlogix/zf2-opensoft-rollout/downloads)](https://packagist.org/packages/adlogix/zf2-opensoft-rollout) [![License](https://poser.pugx.org/adlogix/zf2-opensoft-rollout/license)](https://packagist.org/packages/adlogix/zf2-opensoft-rollout) [![composer.lock](https://poser.pugx.org/adlogix/zf2-opensoft-rollout/composerlock)](https://packagist.org/packages/adlogix/zf2-opensoft-rollout) [![Latest Stable Version](https://poser.pugx.org/adlogix/zf2-opensoft-rollout/v/stable)](https://packagist.org/packages/adlogix/zf2-opensoft-rollout)
55

6-
A ZF2 Module for [opensoft/rollout](https://github.com/opensoft/rollout)
6+
A ZF2 Module for [opensoft/rollout](https://github.com/opensoft/rollout)
7+
8+
# Installation
9+
10+
1. Install the module via composer by running:
11+
12+
```bash
13+
composer require adlogix/zf2-opensoft-rollout ~1.0
14+
```
15+
16+
2. Add the `Adlogix\Zf2Rollout` module to the module section of your `config/application.config.php`
17+
18+
# Configuration
19+
20+
Rollout parameters can be defined in the application configurations:
21+
22+
```php
23+
<?php
24+
return [
25+
'rollout' => [
26+
27+
// Service id to obtain a Opensoft\Rollout\RolloutUserInterface instance
28+
'user_service' => null,
29+
30+
// Service id to obtain a Opensoft\Rollout\Storage\StorageInterface instance
31+
'storage_service' => 'zf2_rollout_storage_array',
32+
33+
// Required configuration if storage service is Adlogix\Zf2Rollout\Storage\ZendDbAdapterStorage
34+
'zend_db_storage' => [
35+
'table_name' => 'rollout_feature'
36+
],
37+
38+
// Required configuration if storage service is Adlogix\Zf2Rollout\Storage\Doctrine\DoctrineORMStorage
39+
'doctrine_storage' => [
40+
'class_name' => SomeFeatureEntity::class
41+
]
42+
],
43+
]
44+
```
45+
46+
# Usage
47+
48+
To retrieve the rollout service from a zend controller:
49+
50+
```
51+
<?php
52+
53+
$rollout = $this->getServiceLocator()->get('zf2_rollout');
54+
```
55+
56+
Refer to the documentation of [opensoft/rollout](https://github.com/opensoft/rollout) for more information on how to use the library.
57+
58+
## Zend Developer Toolbar
59+
60+
The module comes with support for the zend developer toolbar. Currently the toolbar only shows the list of features and enable status for a given user.
61+
62+
![zf2-adlogix-rollout zend developer tools](docs/rollout-zdt.png)

composer.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,33 @@
1919
],
2020
"require": {
2121
"php": ">=5.6",
22-
"opensoft/rollout": "~2.1"
22+
"opensoft/rollout": "~2.2"
2323
},
2424
"require-dev": {
25-
"zendframework/zendframework": "~2.0",
26-
"phpunit/phpunit": "5.5.*",
27-
"doctrine/orm": "*"
25+
"zendframework/zend-developer-tools": "^1.2",
26+
"zendframework/zend-db": "~2.9",
27+
"zendframework/zend-i18n": "~2.8",
28+
"zendframework/zend-log": "~2.10",
29+
"zendframework/zend-mvc": "~2.7",
30+
"zendframework/zend-serializer": "~2.9",
31+
"zendframework/zend-servicemanager": "~2.7",
32+
"doctrine/orm": "~2.5",
33+
"phpunit/phpunit": "~5.0"
2834
},
2935
"autoload": {
30-
"psr-0": {
36+
"psr-4": {
3137
"Adlogix\\Zf2Rollout\\": "src/"
3238
},
3339
"classmap": [
3440
"./"
3541
]
3642
},
3743
"autoload-dev": {
38-
"psr-0": {
39-
"Adlogix\\Zf2RolloutTest\\": "tests/"
44+
"psr-4": {
45+
"Adlogix\\Zf2Rollout\\Test\\": "tests/"
4046
},
4147
"classmap": [
4248
"./"
4349
]
4450
}
45-
}
51+
}

0 commit comments

Comments
 (0)