galantom/galantom-api-php

Galantom Web API 的官方 PHP 客户端库

1.0.2 2018-05-18 08:07 UTC

This package is auto-updated.

Last update: 2024-09-13 11:42:32 UTC


README

Latest Version on Packagist Latest Stable Version Latest Unstable Version

Software License Build Status SensioLabsInsight Quality Score StyleCI Total Downloads

Galantom Web API 的官方 PHP 客户端库

安装

先决条件

  • PHP 版本 5.6 或 7.0

安装包

将 SendGrid 添加到您的 composer.json 文件中。如果您没有使用 Composer,您应该使用它。它是管理 PHP 应用程序依赖项的一种优秀方式。

{
  "require": {
    "galantom/galantom-api-php": "^1.0"
  }
}

快速入门

<?php
// If you are using Composer (recommended)
require 'vendor/autoload.php';

$galantom_api_token = getenv('GALANTOM_API_TOKEN');

use GalantomApi\GalantomClient;
$client = GalantomClient::factory(
    ['api_token' => $galantom_api_token]
);

// Get list of donations
/** @var \GuzzleHttp\Command\Result $response */
$response = $client->getPageDonations(['id' => 327]);

if ($response['response']['code'] !== '200') {
    die($response['response']['message']);
}

foreach ($response['donations'] as $donation) {
    echo $donation['id'].'|';
}