PHPackages                             heldtogether/venice-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. heldtogether/venice-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

heldtogether/venice-php
=======================

v1.1.0(10y ago)016MITPHP

Since Dec 10Pushed 10y ago1 watchersCompare

[ Source](https://github.com/heldtogether/venice-php)[ Packagist](https://packagist.org/packages/heldtogether/venice-php)[ RSS](/packages/heldtogether-venice-php/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (3)Used By (0)

Venice - Multivariate Test Bed [![Build Status](https://camo.githubusercontent.com/b6179b5d8b8f2a91114939dfbbf27a9445baaa64908bb12ecafb11945a69b8a2/68747470733a2f2f7472617669732d63692e6f72672f68656c64746f6765746865722f76656e6963652d7068702e737667)](https://travis-ci.org/heldtogether/venice-php)
=======================================================================================================================================================================================================================================================================================================

[](#venice---multivariate-test-bed-)

Feature toggles are a main tenet of Continuous Integration. Venice allows you to easily turn parts of your app on and off by providing configuration at runtime.

Configuration
-------------

[](#configuration)

Your configuration can be stored however you choose, by creating a class which implements `ConfigInterface`. A class to load your configuration from a JSON file is provided out of the box.

Usage
-----

[](#usage)

In your app's initialisation, bind the Venice Manager and Bucketer as a singleton and bind the session interface to your chosen concrete session class.

```
	$container->singleton('Venice\Manager', function(){
		$factory = new Venice\Factory();
		$config = new Venice\Configs\JSONFileConfig($factory);
		$config->setFilename('/path/to/config/file.json');
		$manager = new Venice\Manager();
		$manager->addConfig($config);
		return $manager;
	});

	$container->singleton('Venice\Bucketer', function(){
		$session = new Venice\Sessions\CookieSession();
		$return new Venice\Bucketer($session);
	});

	$container->bind(
		'Venice\Interfaces\SessionInterface',
		'Venice\Sessions\CookieSession'
	);
```

In any class you wish to use the feature manager, inject the feature manager:

```
	/**
	 * Basic Controller
	 */
	 class Controller {

		/**
		 * @var Venice\Manager
		 */
		protected $features;

		/**
		 * Construct
		 *
		 * @param Venice\Manager $features
		 * @return void
		 */
		public function __construct(Venice\Manager $features) {

			$this->features = $features;

		}

		/**
		 * Handle the index route.
		 */
		public function index() {

			if ($this->features->get('feature-name')->active()) {

				// Do something

			}

		}

	}
```

### Boolean Features

[](#boolean-features)

Boolean features are either on or off, obviously.

```
	{
		'feature-name': true
	}
```

#### Methods

[](#methods)

```
	/**
	 * Check if the Feature is active
	 *
	 * @return bool
	 */
	public function active();

	/**
	 * Set the active state of the feature
	 *
	 * @param bool $active
	 * @return void
	 */
	public function setActive($active)
```

### Timed Features

[](#timed-features)

Timed features are configured to switch on and off according to a schedule. A start time and/or end time can optionally be provided in the config.

```
	{
		'feature-name': {
			'type': 'timed',
			'start_time': '2015-10-06 12:30:20',
			'end_time': '2015-10-10 12:30:20'
		}
	}
```

#### Methods

[](#methods-1)

```
	/**
	 * Check if the Feature is active
	 *
	 * @return bool
	 */
	public function active();

	/**
	 * Get the start time of the Feature
	 *
	 * @return Carbon\Carbon
	 */
	public function startTime();

	/**
	 * Set the time the Feature should be active
	 *
	 * @param string $start_time
	 * @return void
	 */
	public function setStartTime($start_time);

	/**
	 * Get the end time of the Feature
	 *
	 * @return Carbon\Carbon
	 */
	public function endTime();

	/**
	 * Set the time the Feature should become inactive
	 *
	 * @param string $end_time
	 * @return void
	 */
	public function setEndTime($end_time);
```

### Variant Features

[](#variant-features)

Variant features are configured to bucket each session into a certain variant and persist that information between sessions.

```
	{
		'feature-name': {
			'type': 'variant',
			'variants': [
				'control',
				'variant-1',
				'variant-2'
			]
		}
	}
```

#### Methods

[](#methods-2)

```
	/**
	 * Check if the Feature is active
	 *
	 * @return bool
	 */
	public function active();

	/**
	 * Get the variant for the current session
	 *
	 * @return string
	 */
	public function variant();
```

Todo
----

[](#todo)

- Boolean feature
- Timed feature
- Variant feature (for use in A/B testing etc.)
- JSON file config
- Database config

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3855d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1642904?v=4)[Josh Sephton](/maintainers/heldtogether)[@heldtogether](https://github.com/heldtogether)

---

Top Contributors

[![heldtogether](https://avatars.githubusercontent.com/u/1642904?v=4)](https://github.com/heldtogether "heldtogether (54 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/heldtogether-venice-php/health.svg)

```
[![Health](https://phpackages.com/badges/heldtogether-venice-php/health.svg)](https://phpackages.com/packages/heldtogether-venice-php)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M19.5k](/packages/laravel-framework)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M481](/packages/pimcore-pimcore)[illuminate/support

The Illuminate Support package.

582113.0M40.2k](/packages/illuminate-support)[flarum/core

Delightfully simple forum software.

201.4M2.2k](/packages/flarum-core)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k17](/packages/solspace-craft-freeform)[fisharebest/webtrees

webtrees online genealogy

77416.0k20](/packages/fisharebest-webtrees)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
