graphem / thinkific-php
简单的Thinkific API PHP库
v2.2.0
2022-04-11 19:42 UTC
Requires
- firebase/php-jwt: ^6.1
- guzzlehttp/guzzle: ^7.2
This package is auto-updated.
Last update: 2024-09-12 00:49:41 UTC
README
基于文档的轻量级Thinkific API库,文档可在此处找到 https://developers.thinkific.com/api/api-documentation/
要求
- PHP 7.4+
安装
可以使用Composer安装Thinkific PHP API客户端。
Composer
要安装,请运行composer require graphem/thinkific-php
配置
配置通过Thinkific\Thinkific
的一个实例完成。该块是必需的,如果不传递,将抛出错误。
// load Composer require 'vendor/autoload.php'; use \Thinkific\Thinkific; $subdomain = "subdomain"; $apiKey = "yourapikey"; $client = new Thinkific($apiKey,$subdomain);
使用
基本操作
// Get all the courses $courses = $client->courses()->getAll(); print_r($courses); // Find a user by email $user = $client->users()->findByEmail('me@domain.com'); print_r($user); // Encoll a user to a course $enroll = $client->enrollments()->create($courseId,$userId, '2020-01-01', '2021-01-01'); // Generate SSO link $link = $client->sso()->getLink('signed-by (your application name or url)', ['email' => 'me@domain.com', 'first_name' => 'Me', 'last_name' => 'Hey']);