elliotboney/thinkific-php

与Thinktastic LMS API交互的PHP SDK

dev-master 2020-01-09 20:16 UTC

This package is not auto-updated.

Last update: 2024-09-20 07:28:49 UTC


README

Dependency Status

此项目正在积极开发中,处于早期alpha阶段。它是一个用于帮助与Thinkific LMS API交互的SDK。该REST API的文档可以在这里找到。

安装

最新版本

在开发过程中,您可以通过将thinkific-api的版本要求设置为dev-master来跟进master分支的最新更改。

{
   "require": {
      "elliotboney/thinkific-php": "dev-master"
   }
}

通过命令行

composer require elliotboney/thinkific-php

用法

创建一个用于与API交互的客户端

$think = new \Thinkific\Thinkific ( [
   'apikey'    => 'your-api-key',
   'subdomain' => 'yoursubdomain',
   'debug'     => true
   ] );

端点

您可以通过以下方案访问以下端点

  • 捆绑包
  • 集合
  • 优惠券
  • 课程评价
  • 课程
  • 注册
  • 订单
  • 产品
  • 促销
  • 用户

使用以下方案

// Create interface to access Users endpoint
$users = $think->users();

// Create interface to access Bundles endpoint
$bundles = $think->bundles();
// etc, etc

方法

类有基本的GET、PUT、POST、DELETE请求,以及带有ID参数的getAll。如果端点不支持调用,将抛出ApiException()异常。访问这些端点的示例

// Get all users
$users = $users->getAll();

// Get a specific user
$users->getById(1234);

// Add a user
$users->add([
    "first_name" => "John",
    "last_name" => "Doe",
    "email"=>"johndoe@example.com",
    "roles"=>[]
  ]);

// Update a user
$users->update( 1234, [
    "first_name" => "John",
    "last_name" => "Doe",
    "email"=>"johndoe@example.com",
    "roles"=>[]
  ]);

// Delete a user
$users->delete( 1234);

有关哪些端点支持哪些的更多详细信息,请确保您查阅了Thinkific API文档