An example of a project to take as a proof of concept that helps to integrate the Bullet Train API with PHP.
This project does not aim to cover best practices for PHP project development as a whole. For example, it does not provide an exhaustive documentation, or unit tests.
However, it provides a good foundation for integrating your developments under the continuous deployment approach, including the implementation of feature flags via Bullet Train.
You'll need docker and docker-compose.
To work properly, Bullet Train requires a Google Analytics account. For testing purposes, I abandoned this feature by injecting a workaround into the API.
Do not use this in production !
git clone https://github.com/joogoo/bullet-train-php-sample.git;
cd bullet-train-php-sample;
docker run --rm --interactive --tty \
--volume $PWD:/app \
composer install
docker-compose up -d
docker exec -it bullet-train-php-sample_api_1 pipenv run python src/manage.py createsuperuser
-
Go to http://localhost:8082/ and sign in with the super admin account you created previously.
-
Create an organization, a project and finally 2 feature flags:
ID | Description | Enabled |
---|---|---|
login | Login feature | your choice |
nice_ui | Nice UI feature | your choice |
-
Get the environment key for this project (see the
environmentID
value in theCode example: 2: Initialising your project
section) and save it as your API_KEY in a conf/client.local.php -
Go back to http://localhost:8080/ and enjoy switching features in Bullet Train [http://localhost:8082].
Three fake accounts are available for testing purposes, so you can go further activating features for some users only with Segments and User Traits.
Login | Password |
---|---|
callisto | fake1 |
ganymede | fake2 |
europa | fake3 |