Download the PHP package featurit/featurit-sdk-symfony without Composer

On this page you can find all versions of the php package featurit/featurit-sdk-symfony. 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 featurit-sdk-symfony

FeaturIT SDK for Symfony

Symfony wrapper of the PHP client for the FeaturIT Feature Flag management platform.

Description

This package aims to simplify the integration of the FeaturIT API in a Symfony project.

Getting started

Dependencies

Installing

composer require featurit/featurit-sdk-symfony -W

If there's no package providing psr/http-client-implementation, visit https://packagist.org/providers/psr/http-client-implementation and choose the package that better suits your project.

If there's no package providing psr/simple-cache-implementation, visit https://packagist.org/providers/psr/simple-cache-implementation and choose the package that better suits your project.

Inside your config/bundles.php file, add:

If you want to create your own configuration file in order to customize things like the default FeaturitUserContextProvider, create a file in config/packages/featurit.yaml with the following contents:

You also need to create the proper environment variables in your .env file.

Basic Usage

That's how you would use Featurit in one of your controllers, services, or anywhere inside your PHP codebase:

Or in order to check which is the version of your feature:

Twig extension

For convenience we provide 2 twig functions which allow to render html depending on the Feature Flag values.

Inside your twig template, you can use them like this:

Defining your FeaturitUserContext

In order to show different versions of a feature to different users, Featurit needs to know about the attributes your user has in a certain context.

You can define the context using the as follows:

Defining a custom FeaturitUserContextProvider

This is an alternative to using $featurit->setUserContext(...);.

By default, Featurit SDK for Symfony comes with a default FeaturitUserContextProvider adapted for Symfony, but if you want to create your own, create a service un your services.yaml file as follows:

And then add it to the featurit.yaml config file as:

Let's say that your platform users have a "role" attribute that you use to decide which features you show to each user. In that case you could create an implementation like:

Then you must replace your implementation in the featurit.yaml file as explained before.

And that should do it, from now on your segmentation rules will use the role attribute.

Event Tracking

In order to track some event in your application, you can add this once the event has happened:

All the events you track in the same request will be accumulated and associated to the current FeaturitUserContext, if for some reason you want to send the event immediately, you can do as follows:

Custom cache implementation

By default, FeaturIT SDK for Symfony provides a simple File cache. Once you have multiple servers, you will want to inject your custom Psr\SimpleCache\CacheInterface implementation using some distributed cache system.

This can be done as follows:

Authors

FeaturIT

https://www.featurit.com

[email protected]


All versions of featurit-sdk-symfony with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
featurit/featurit-sdk-php Version ^1.0.0
symfony/framework-bundle Version ^5.2 || ^6.0 || ^7.0
nyholm/psr7 Version ^1.5
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 featurit/featurit-sdk-symfony contains the following files

Loading the files please wait ....