1.3.0 2014-12-19 23:02 UTC


Online Marketplace Payments

Build Status

The design of this library was heavily influenced by Httpful.

v1.x requires Balanced API 1.1. Use v0.x for Balanced API 1.0.

v0.x requires Balanced API 1.0.


In the past this README incorrectly communicated specifying * for the version of balanced. master, 1.x, requires Balanced API v1.1 and will require updates to your application. Applications using * to specify the balanced version obtained via Composer will automatically pick up the latest version and will cause issues for applications that have not been updated to use balanced-php 1.x. If your application is configured in the manner, we advise you to pin your balanced version at 0.*, or something more specific such as, to ensure your application continues to function normally using Balanced API v1.0 until you're able to upgrade to the latest version.



Please use appropriately tagged github issues to request features or report bugs.


You can install using composer or from source. Note that Balanced is PSR-0 compliant:


If you don't have Composer install it:

$ curl -s | php

Require balanced in your composer.json:

    "require": {
        "balanced/balanced": "1.*"

NOTE: You may also define a more specific version if desired, e.g. 1.0.1

Refresh your dependencies:

$ php composer.phar update

Then make sure to require the autoloader and initialize all:

require(__DIR__ . '/vendor/autoload.php');



Download Httpful source:

$ curl -s -L -o;
$ unzip; mv nategood-httpful* httpful; rm

Download RESTful source:

$ curl -s -L -o;
$ unzip; mv matthewfl-restful* restful; rm

Download the Balanced source:

$ curl -s -L -o
$ unzip; mv balanced-balanced-php-* balanced; rm

And then require all bootstrap files:

require(__DIR__ . "/httpful/bootstrap.php")
require(__DIR__ . "/restful/bootstrap.php")
require(__DIR__ . "/balanced/bootstrap.php")



Refer to the Quickstart guide in the Balanced Documentation.


See for guides and documentation.


$ phpunit --bootstrap vendor/autoload.php tests/

Or if you'd like to skip network calls:

$ phpunit --exclude-group suite --bootstrap vendor/autoload.php tests/


  1. Ensure that all tests pass
  2. Increment minor VERSION in src/Balanced/Settings and composer.json (git commit -am 'v{VERSION} release')
  3. Tag it (git tag -a v{VERSION} -m 'v{VERSION} release')
  4. Push the tag (git push --tag)
  5. Packagist will see the new tag and take it from there


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write your code and tests
  4. Ensure all tests still pass (phpunit --bootstrap vendor/autoload.php tests/)
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create new pull request

Documentation scenarios

Each scenario lives in the scenarios directory and is comprised of the following:

  • definition.php - Method definition
  • request.php - Scenario code
  • executable.php - Processed request.php. Can be executed directly in PHP. Generated by render_scenarios.php.
  • php.mako - Documentation template to be consumed by balanced-docs. Generated by - render_scenarios.php.

Scenarios can be validated by running validate_scenarios.php from within the scenarios folder.