Download the PHP package yannickl88/features-bundle without Composer

On this page you can find all versions of the php package yannickl88/features-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 features-bundle

features-bundle

This Symfony bundle provides a way of managing features within a project. A common use-case is to have a certain feature only active under certain condition. Examples would be that you want to activate a feature when the use has a certain role, or when you are not in a production environment (think of testing).

With this bundle you can configure features to be active or inactive. Using resolvers you decide when a feature is active or not.

Requirements:

Recommended installation is via composer: composer require yannickl88/features-bundle.

After that, you need to register the bundle in the kernel of your application:

Usage

All configuration is done using services and your application config. For the following example we want to enable a feature when the GET parameter beta is set to on.

So configuring your feature in the config.yml of your application.

Here we define a feature tag beta which will be resolved with the request resolver. Now we need to configure the request resolver. We do this with the following service definition:

Here we create the app.features.request_resolver service and tag it with features.resolver. This will then be picked up by the bundle and be registered so we can use it in our feature tags. What we also provide is a config-key value. This is the key that we defined in the config.yml under the beta tag. This will glue your config to your resolver.

Final thing to do is implement the RequestResolver:

Now we can start using the feature in our code. So if I want to check for a feature I can inject it as follows:

Notice here that we do not inject the feature directly, but tag the service. The bundle will replace the feature for you. So you can use it as follows in your code:

So if I now add ?beta=on to my URL. The feature will trigger.

Note: If you remove the tag, it will inject a deprecated feature. This deprecated feature will trigger a warning when the isActive is used so you will quickly see where unused feature are used.

Twig

If it also possible to check a feature in your twig templates. Simply use the feature function to check if a feature is enabled.

Advanced Topics

It is possible to configure multiple resolvers per feature tag. You can simply keep adding more in the config.yml. So in the example we can extend it to:

All resolvers must now resolve to true in order for this feature to be active. This is usefull if you want to check for multiple conditions.

Furthermore, if you want to have multiple resolvers where only one needs to resolve to true, you can use the chain resolver. This can be done as follows:

Notice here we have as resolver chain and under this we have your config as before.


All versions of features-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
symfony/config Version ^5.4||^6.0
symfony/dependency-injection Version ^5.4||^6.0
symfony/finder Version ^5.4||^6.0
symfony/framework-bundle Version ^5.4||^6.0
symfony/http-kernel Version ^5.4||^6.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 yannickl88/features-bundle contains the following files

Loading the files please wait ....