Api interface for your toggles.

1.0.1 2022-06-27 09:17 UTC

This package is auto-updated.

Last update: 2024-04-04 23:15:48 UTC


An API for managing your toggles, uses Redis to store the toggle collection.

build status


Read our blog post series about this repository at:


Install the dependencies with composer:

make dependencies

Configuration is determined based on environment variables. See the .env.* files. You can override the values in the file with environment values. The default configuration is mainly for local development.

The environment variable TOGGLE__ALLOWED_ORIGINS should be valid JSON. This is to allow arrays.

Running the tests

We use PHPUnit, so to run the tests simply run:

docker-compose up -d
make test

Running the app

With your favorite webserver (or with php -S -t public for local testing) point your document root to the public folder.


Retrieve the toggles

GET /toggles

Create or update a toggle

PUT /toggles/{name}

Example request:

   "conditions" : [
         "name" : "operator-condition",
         "operator" : {
            "name" : "less-than",
            "value" : "1337"
         "key" : "user_id"
   "name" : "foo",
   "status" : "conditionally-active",
   "originalName" : "foo"

NOTE: PUT doesn't remove the previous toggle if you rename it. So if you want to rename foo to bar, you would have to PUT bar and DELETE foo.

Delete a toggle

DELETE /toggles/{name}