Download the PHP package youcanshop/foggle without Composer

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

Foggle

A feature flagging package for Laravel, built with DX in mind.

[!NOTE] Some features are not yet implemented:

  • Feature resolutions purge command.
  • Pre-resolution hook for global flagging.

Installation

Install Foggle into your project using composer:

You should then publish the configuration files using the following artisan command:

Configuration

After publishing, the configuration file will be located at config/foggle.php. This is where you configure your storage providers and context resolvers. Foggle allows you to store the resolution of your feature flags in a vast array (haha) of data stores, or in an in-memory array driver.

Feature Definition

To define a feature, you can use the define method of the foggle() helper. You will need to provide a name of the feature, as well as a closure that resolves the initial value.

Usually, a feature should be defined in a dedicated service provider. The closure will receive the context for the resolution as an argument, which is most commonly your application's User model.

The first time the themes feature is resolved for a given context (user), the result will be stored by your configured driver. The next time it is checked against the same context, the closure will not be invoked, and the value will be retrieved from the storage.

Class Based Features & Discovery

Foggle allows you to define class based features. These classes can be automatically discovered and registered into the feature manager. By default, the auto-discovery path is app/Features but this can be changed from the config file.

When writing a feature class, you need to define a resolve or __invoke method, which will be called to resolve the feature's initial value. In this case, the class' FQN will be used as a feature name, but you can override it by defining a public name method on your feature class.

Checking Features

To evaluate a feature's value, you may use the active method on the foggle() helper.

If you need to check a feature against a specific context, you can prepend the feature resolution call call with a for method like so:

In-Memory Cache

When resolving a feature, Foggle will create an in-memory cache of the result. If you are using the redis driver for example, this means that re-checking hte same feature within the lifetime of a single request will not trigger additional Redis queries.

If you need to manually flush the in-memory cache, you can use the cFlush method on the foggle() helper. Note that when running in console, in-memory cache is flushed every time a job is processed to ensure long-running worker processes will always have the latest values.

Context

Resolvers

As mentioned before, Foggle allows you to check your features against any context using the for method on foggle(). However, if you would like to omit the for every time you check a feature, you can configure custom context resolvers in the config file.

You can do so by creating a class that implements ContextResolver like so:

You should then bind this class to the type of context it resolves, which is Store in this case, in the config file:

Defining A Feature's Context Type

By default, if you do not provide context to a feature, it will not try to use a context resolver and will default to null. You can tell Foggle which resolver to use in the feature definition in one of two ways:

Context Identifiers

Foggle's built-in drivers will store your context alongside the resolution value in their stores. However, serializing some contexts as-is can be heavy on some data stores (e.g. Redis) which is why every context that isn't a string must implement the Foggable interface.

Feature generation

Some features are often too simple to warrant an entire class or a repeated closure on each definition, which is why Foggle provides FogGen class that generates common feature closures.

FogGen::inconfig()

The inconfig method takes a config path and generates a feature that checks if the given context's identifier is included in the provided config's value. If the config value is a string, inconfig attempts to explode it into an array using the , separator by default, which can be changed using its optional 2nd param.

In this case, it will check if the store's id attribute exists within the features.billing-v2.stores value.


All versions of foggle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
azuradara/illumake Version ^1.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 youcanshop/foggle contains the following files

Loading the files please wait ....