eziteq/eziteq-api_php

PHP API包装器

v1.0.0 2015-04-10 13:48 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:07:13 UTC


README

#Eziteq

Build Status Latest Stable Version

为Eziteq API请求提供PHP 5.3+包装器。

##安装您可以通过composer安装EziteqAPI_PHP或通过下载源代码来安装。

通过Composer

EziteqAPI_PHP作为eziteq/eziteq-api_php软件包在Packagist上可用。

{
    "require": {
        "eziteq/eziteq-api_php": "{version}"
    }
}

通过ZIP文件

点击此处下载源代码(.zip),其中包含所有依赖项。

下载库后,将EziteqAPI_PHP文件夹移动到您的项目目录中,然后包含包装器文件

require '/path/to/EziteqAPI_PHP/EziteqAPI.php';

然后您就可以使用了!

##要求

需要PHP 5.3.9(或更高版本)。如果您有权限,强烈建议使用PHP 5.4(或更高版本)以提高性能。

文档

联系Eziteq获取API访问和文档。

###示例用法

<?php

use EziteqAPI_PHP\EziteqAPI;

    // Make sure composer dependencies have been installed
    require __DIR__ . '/vendor/autoload.php';
	
	//Init and authenticate with Api key
	$eziteq = EziteqAPI::init(array(
		'apiKey' => 'a84fhgncmc432mgsa31' // Api key from Eziteq
	));

	//Init and authenticate with OAuth2
	$eziteq = EziteqAPI::initOAuth2(array(
		'clientId' => 14513528982,
		'secret' => 'b3f89ee80ca90adf9fe75535c974a400',
		'redirect_uri' => 'https://my.app/login'
	));
	
	if($eziteq->authenticate()) {
		
		// Get subscriptions
		$subscriptions = $eziteq->getSubscriptions();
		
		// Get specific customer
		$customer = $eziteq->getCustomer(array(
			'customerId' => 5432
		));
		
	} else 
		throw new Exception($eziteq->getMessage(), $eziteq->getCode()));