PHP Client for Joystick Remote Config
Use Joystick to easily manage and integrate JSON remote configs with your PHP projects. Joystick is a modern remote config platform to manage all of your configurable parameters behind one API. We are natively multi-environment, preserve your version history, have advanced work-flow & permissions management, and much more.
This library simplifies how your PHP project can communicate with Joystick API to get remote configs over REST API.
PHP 7.2 and later
You can install the package via Composer:
To use the client, use Composer's autoload:
Simple usage looks like this:
Requesting Content by single Content Id
Specifying additional parameters:
When creating the
ClientConfig object, you can specify additional parameters which will be used
by all API calls from the client, for more details see
In most of the cases you will be not interested in the full response from the API, but if you're you can specify
fullResponse option to the client methods. The client will return you raw API response:
true, we will pass query parameter
to Joystick API.
If you want to ignore existing cache and request the new config – pass this option as
This option can be set for every API call from the client by setting
By default, the client uses array caching, which means that if you build the HTTP application where each process exits after the request has been processed – the cache will be erased after the process is finished.
You can specify your cache implementation which conforms PSR-16.
examples/file-cache for more details.
Clear the cache
If you want to clear the cache – run
Note that we will call
clear()on the PSR-16 interface. Make sure that you use different cache instances in different places of your app
If you want to provide custom HTTP client, which may be useful for use-cases like specifying custom proxy, collecting detailed metrics about HTTP requests,
You can specify your HTTP client implementation which conforms PSR-18.
examples/custom-http-client for more details.
To run unit tests, just run:
Questions or Issues
Please reach out with any questions or issues.