Download the PHP package dose/feature without Composer

On this page you can find all versions of the php package dose/feature. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package feature

Feature

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Feature is a rampup and AB testing library inspired by Etsy\Feature. It is NOT a direct replacement, but it can do everything Etsy's library can and more.

API

The main method is:

This will return a selected variant. It may also return NULL if the feature does not exist or if none of the variants were selected (features with incomplete coverage).

Before you can check for variants you need to define a few methods that will allow the Feature library to retrieve your configuration on-demand. This is done by injecting an implementation of the Connector interface into the Feature instance.

The Connector interface defines two methods:

This is used to retrieve a context in which the variant will be selected. A variant will be selected for each context individually. Most of the time this will be set to a unique user id or session id. You can, for example, set this to reflect an article id. In this case, all users will see the same result but it will change between different articles.

This method allows the Feature instance to retrieve an instance of Entity class that will be used to select a variant.

Entity

To define a feature, your implementation of the getEntity($name) method needs to return an Entity instance. Once you create an Entity object, add variants to it using the following method:

This will add a specified variant to the feature. The odds can range between 0 and 100 and don't need to be whole numbers.

Migrating from Etsy\Feature

How do I check if a feature is enabled?

Etsy's library separates the concept of a feature and variant; which forces you to wrap each call to the variant() method in a conditional.

We eliminated the isEnabled($name) method completely and use the getVariant($name) method to determine if a feature is enabled:

Or:

How do I define a feature that is on 50% of the time and has no variants?

This is done by defining a single variant with the odds set to 50:

Now you can simply check if the selected variant is true:

How do I define a feature that applies to certain users or user groups?

This is done during the configuration of the feature:

In the above example, the feature will be always on for admins and for 20% of visitors.


All versions of feature with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dose/feature contains the following files

Loading the files please wait ....