PHP code example of tribepeer / sdk

1. Go to this page and download the library: Download tribepeer/sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tribepeer / sdk example snippets


$tp = new TribePeer\Client(
    clientId: env('TP_CLIENT_ID'),
    clientSecret: env('TP_CLIENT_SECRET'),
);

$classes = $tp->tribes()->list();

// AI: set materials, then a quiz
$notes = $tp->ai()->material(['topic' => 'Photosynthesis', 'level' => 'SS2']);
$quiz  = $tp->ai()->quiz(['material' => $notes, 'questions' => 10]);

// Learners sit the quiz; you track them
$tp->campus()->submitQuiz($tribe, $material, ['answers' => $answers]);
$roster = $tp->campus()->students($tribe);
$done   = $tp->campus()->complete($tribe, $material);