定制 brightflair/spektrix-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

brightflair/spektrix-api

最新稳定版本:v0.1.0

Composer 安装命令:

composer require brightflair/spektrix-api

包简介

Self-documenting, type-safe Spektrix web API.

README 文档

README

This is an unofficial library for accessing Spektrix's v3 API, built to abstract complex authentication in a self-documenting, type-safe PHP API.

Getting an access key

Official docs here: https://support.spektrix.com/hc/en-us/articles/360013592837-Setting-Up-an-API-User

  1. Associate a username, email address and mobile telephone number to a new API user.
  2. The username is required, along with a provided client name, to access the API.
  3. Email address will receive a link to click with a one-off token.
  4. On the page linked via email, enter a code sent via SMS.
  5. You will receive your secret API key - this is used when construct the Client object.

Authentication

API authentication is abstracted by this library, because it involves a multiple-step time-sensitive SHA-1 hashing exercise. To authenticate this library, pass your username and client name into the constructor of the Client object.

$username = "greg\brightflair";
$clientName = "api-test";
$secretKey = "S2VlcCB5b3VyIGtuaWNrZXJzIG9uISBUaGlzIGlzIGEgdGVzdCBBUEkga2V5LCBkb24ndCB3b3JyeSE=";
$client = new BrightFlair\SpektrixAPI\Client($username, $clientName, $secretKey);

Endpoints of the API

Endpoints are mapped to type-safe functions in the library. Use your IDE for self-documentation, with the following naming convention:

  • Functions begin with "create" / "get" / "update".
  • Functions then include the entity name, such as "customer" / "tag".
  • Matching mechanisms are provided as named parameters, such as "id" / "name".

Example call to get a customer, get a tag by its name, and add the tag to the customer's record:

$customer = $client->getCustomerByEmail("greg.bowler@brightflair.com");
$tag = $client->getTagByName("Example tag");
$client->addTagToCustomer($customer, $tag);

Missing functionality

I have built this library for my own use to integrate with Nimbus Disability. I don't plan on building any more functionality than is required for the type of integration I'm using, unless someone persuades me to develop it further.

The following features are implemented, and tested with examples:

  • Create customer
  • Get customer (id or email)
  • Get tag by ID
  • Get all tags
  • Get tags for customer
  • Add tag to customer
  • Remove tag from customer

More functionality will only be added as and when it is required by integrations, but others are free to create pull requests.

统计信息

  • 总下载量: 143
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-02-07