Braintree Slim Example
An example Braintree integration for PHP in the Slim framework.
Install composer and project dependencies:
curl -sS https://getcomposer.org/installer | php php composer.phar install
Copy the contents of
example.envinto a new file named
.envand fill in your Braintree API credentials. Credentials can be found by navigating to Account > My User > View Authorizations in the Braintree Control Panel. Full instructions can be found on our support site.
php -S 0.0.0.0:3000
Deploying to Heroku
You can deploy this app directly to Heroku to see the app live. Skip the setup instructions above and click the button below. This will walk you through getting this app up and running on Heroku in minutes.
Integration tests make API calls to Braintree and require that you set up your Braintree credentials. You can run this project's integration tests by adding your sandbox API credentials to
.env and calling
vendor/bin/phpunit on the command line.
APP_SECRET_KEYsetting. Even in development you should generate your own custom secret key for your app.
- Found a bug? Have a suggestion for improvement? Want to tell us we're awesome? Submit an issue
- Trouble with your integration? Contact Braintree Support / firstname.lastname@example.org
- Want to contribute? Submit a pull request
This code is provided as is and is only intended to be used for illustration purposes. This code is not production-ready and is not meant to be used in a production environment. This repository is to be used as a tool to help merchants learn how to integrate with Braintree. Any use of this repository or any of its code in a production environment is highly discouraged.