Download the PHP package ajgarlag/feature-flag-bundle without Composer

On this page you can find all versions of the php package ajgarlag/feature-flag-bundle. 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-flag-bundle

FeatureFlag Bundle

The FeatureFlag Bundle allows you to split the code execution flow by enabling features depending on context.

It provides a service that checks if a feature is enabled. Each feature is defined by a callable function that returns a value. The feature is enabled if the value matches the expected one (mostly a boolean but not limited to).

This bundle code has been borrowed from https://github.com/symfony/symfony/pull/53213.

[!IMPORTANT]
The purpose of this bundle is to allow you to test the code proposed in the PR.

πŸš€ Getting Started

Follow these steps to install and use the bundle in your Symfony application.

Step 1: Download the bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

Step 2: Enable the bundle (for non-Flex applications)

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

✨ Declaring features with attributes

You can declare features using the #[AsFeature] attribute. This allows you to autoconfigure your features as services.

On a class

You can use the attribute on an invokable class:

The feature will be named xmas. If you don't provide a name, the FQCN of the class will be used.

You can also use the method property of the attribute to specify a method to call on the service.

On a method

You can also use the attribute on a method of a service. The method must be public.

πŸ—ΊοΈ Routing integration

The bundle provides two functions to use in route conditions: feature_is_enabled and feature_get_value.

You can use them to enable or disable routes based on features.

You can also use feature_get_value to check for a specific value.

🧩 Providers

Providers are responsible for returning the feature callables. You can create your own provider by implementing the ProviderInterface.

Any service that implements ProviderInterface is automatically registered as a provider. The bundle comes with a ChainProvider that allows you to combine multiple providers. The first provider that returns a feature wins.

The ProviderInterface

To create your own provider, you need to implement the ProviderInterface.

The get method must return a callable if the provider has the feature, or null otherwise.

Doctrine example
Gitlab example First, declare a service to interact with the [Unleash](https://www.getunleash.io/) API.

Priority

You can control the order of the providers in the chain using the priority attribute on the ajgarlag.feature_flag.provider tag.

You can use the #[AutoconfigureTag] attribute to set the priority of your provider.

Providers with a higher priority will be checked first.

🎨 Twig extension

The bundle provides two functions to use in Twig templates: feature_is_enabled and feature_get_value.


All versions of feature-flag-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
psr/container Version ^1.1|^2.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 ajgarlag/feature-flag-bundle contains the following files

Loading the files please wait ...