实现iDoklad API v2

dev-master / 0.2.x-dev 2020-02-03 16:16 UTC

This package is auto-updated.

Last update: 2024-09-29 05:49:26 UTC


README

PHP7库,用于调用iDoklad API (v2)。库目前尚未 稳定

使用Composer安装

composer require katuscak/idoklad

基本用法

use Fousky\Component\iDoklad\Functions as Func;
use Fousky\Component\iDoklad\iDoklad;
use Fousky\Component\iDoklad\iDokladFactory;

/** 
 * Create iDoklad client with specific configuration.
 *
 * @var \Fousky\Component\iDoklad\iDoklad $idoklad
 */
$idoklad = iDokladFactory::create([
    'client_id' => '##TODO:INSERT CLIENT ID##',
    'client_secret' => '##TODO:INSERT CLIENT SECRET##',
]);

/**
 * Execute function (iDokladFunctionInterface), 
 * this will call iDoklad API and returns model object (iDokladModelInterface).
 *
 * @var \Fousky\Component\iDoklad\Model\Contacts\ContactCollectionModel $responseModel
 */
$responseModel = $idoklad->execute(
    new Func\Contacts\GetContacts()
);

/**
 * Here you have response data from iDoklad API in model class
 * @see GetContacts::getModelClass
 */
var_dump($responseModel);