Download the PHP package cleancode/feature-toggle-bundle without Composer

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

Feature-Toggle-Bundle

Description

Feature toggle is responsible for switching service injection depending on configuration.
Allowing to modify system behavior without changing code.

Example

Example use JMSDiExtraBundle, but you can easily configure it with services.yml

Let's say we want to store images. On developer machines we want to store them on file system, but anywhere else we want to store them on amazon.

interface PictureStorage
{
    /**
     * @param PictureWithContent $picture
     * @return void
     */
    public function store(string $pictureName, string $content);
}

/**
* @DI\Service("amazon_picture_storage")
* @DI\Tag(name="toggle", attributes={"for"="picture_storage", "on"="amazon_storage", "when"="enabled"})
*/
class AmazonPictureStorage
{
    public function store(string $pictureName, string $content)
    {
        // send it amazon
    }
}

/**
* @DI\Service("file_system_picture_storage")
* @DI\Tag(name="toggle", attributes={"for"="picture_storage", "on"="amazon_storage", "when"="disabled"})
*/
class FileSystemPictureStorage
{
    public function store(string $pictureName, string $content)
    {
        // save it locally
    }
}

Now when we have our services defined. We have to set default service, that will always be chosen, if all when specification fails. We are doing it by service aliases. The default for us is amazon_picture_storage

services.yml
    picture_storage:
       alias: amazon_picture_storage

We should also have the parameter, that we are using for deciding which implementation to pick.
In our example it's amazon_storage.

parameters.yml
    amazon_storage: "disabled"

We can make use of our storage now.

class AppController
{
    private $pictureStorage;

    /**
     * @DI\InjectParams({
     *      "pictureStorage" = @DI\Inject("picture_storage")
     * })
    */
    public function __construct(PictureStorage $pictureStorage)
    {
        $this->pictureStorage = $pictureStorage;       
    }

    public function createPersonWithImage(string $pictureName, string $content)
    {
        $this->pictureStorage->store($pictureName, $content);
    }
}
Annotation Explained

@DI\Tag(name="toggle", attributes={"for"="picture_storage", "on"="amazon_storage", "when"="disabled"})

So service that contains above tag will be used when amazon_storage parameters will be equal to "disabled"


All versions of feature-toggle-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
symfony/framework-bundle Version ~3.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 cleancode/feature-toggle-bundle contains the following files

Loading the files please wait ....