digitaleo/php-sdk

Digitaleo API 的 PHP 客户端

dev-master 2022-04-03 20:29 UTC

This package is auto-updated.

Last update: 2024-08-30 01:06:43 UTC


README

Digitaleo PHP SDK

SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

此库旨在为开发者提供一个与 Digitaleo API 一起工作的良好 SDK。

如何使用它

在您的项目目录中

运行

composer require digitaleo/php-sdk

然后可以这样使用

<?php

require './vendor/autoload.php';

$credentials = new \Digitaleo\SDK\Api\Credentials(
    'your-client-id',
    'your-client-secret',
    'your-username',
    'your-password'
);
$adapter     = new \Digitaleo\SDK\Api\Authentication\OAuth2Adapter($credentials);
$client      = new \Digitaleo\SDK\Api\Client($adapter);

# How to post a contact
$response = $client->post('https://contacts.messengeo.net/rest/contacts', [
    'contacts' => [
        ['civility' => 'M', 'firstName' => 'Michel', 'lastName' => 'Patrick', 'phone' => '0605040302'],
    ],
]);

# How to retrieve your campaigns
$response = $client->get('https://api.messengeo.net/rest/campaigns');

路线图

  • 带有 OAuth 的基本 HTTP 客户端
  • 添加测试
  • 添加文档
  • 找到一种避免传递完整 URL 作为资源的方法
  • 更新 HTTP 客户端以提供类似 "Active Record" 的接口