tcdev/thinkific-php

PHP SDK for interacting with the Thinkific LMS Api

v1.0.0 2023-10-25 12:44 UTC

This package is auto-updated.

Last update: 2024-10-25 17:06:16 UTC


README

Dependency Status

This is under heavy construction and in early alpha stages. It is an sdk to help interact with the Thinkific LMS API. The documentation for that REST Api can be found here.

Installation

Bleeding Edge

During your development, you can keep up with the latest changes on the master branch by setting the version requirement for thinkific-api to dev-master

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

Via command line:

composer require elliotboney/thinkific-php

Usage

Create a client for interacting with the API:

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

Endpoints

You can reach the following endpoints:

  • Bundles
  • Collections
  • Coupons
  • Course reviews
  • Courses
  • Enrollments
  • Orders
  • Products
  • Promotions
  • Users

by using the following scheme:

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

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

Methods

The classes have the basic requests for GET, PUT, POST, DELETE with the Id parameter as well a getAll. If the endpoint doesn't support the call, an ApiException() will be thrown. Some examples of accessing these endpoints:

// 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);

For more details of which endpoints support which, please make sure you look through the Thinkific API Docs.