This is a PHP library that allows interaction with Mango API
* PHP 5.3+
If you're using Composer, add this to
your composer.json require
:
{
"require" : {
"mango/mango-php" : "dev-master"
}
}
And load it using Composer's autoloader
require 'vendor/autoload.php';
To install the source code:
$ git clone git@github.com:mango/mango-php.git
Include mango-php
in your code and autoload requests
:
require_once '/path/to/mango-php/mango.php';
require_once '/path/to/rmccue/requests/Requests.php';
Requests::register_autoloader();
Documentation is available at https://developers.getmango.com/en/api/?platform=php
$mango = new Mango\Mango(array(
"api_key" => "YOUR_SECRET_API_KEY"
));
In order to create a Customer, you must call the create()
method with the required arguments.
$customer = $mango->Customers->create(array(
"email" => "test-php@example.org",
"name" => "Test Customer"
));
var_dump($customer);
When you have a customer uid
, you can get a full detail using the get()
method:
$customer = $mango->Customers->get("customer_1uqh884oy1ujh9y9eatm0jo3zxu0rm2s");
var_dump($customer);
You can also work with all the other resources authenticated with a secret API Key:
Install the module along with the dev dependencies using composer:
$ git clone git://github.com/mango/mango-php.git
$ cd mango-php
$ composer install
To run the tests you'll need Mango API keys (mode Sandbox):
export MANGO_SECRET_TEST_KEY='your secret test API key'
export MANGO_PUBLIC_TEST_KEY='your public test API Key'
$ phpunit test
To run the code coverage you'll need Xdebug
$ phpunit --coverage-html coverage
Licensed under the MIT license.
Copyright (c) 2014 Mango.