mango/mango-php
最新稳定版本:0.1.2
Composer 安装命令:
composer require mango/mango-php
包简介
Mango API client for PHP
README 文档
README
This is a PHP library that allows interaction with Mango API
Installation
Dependencies
* PHP 5.3+
Install with Composer
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';
Install from GitHub
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
Documentation is available at https://developers.getmango.com/en/api/?platform=php
Usage
Set your secret API key:
$mango = new Mango\Mango(array( "api_key" => "YOUR_SECRET_API_KEY" ));
Create a customer
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);
Get single 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:
Tests
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'
Run the tests
$ phpunit test
Run code coverage
To run the code coverage you'll need Xdebug
$ phpunit --coverage-html coverage
License
Licensed under the MIT license.
Copyright (c) 2014 Mango.
统计信息
- 总下载量: 65
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-04