PHP code example of phpinnacle / langcat

1. Go to this page and download the library: Download phpinnacle/langcat 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/ */

    

phpinnacle / langcat example snippets


use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Psr7\HttpFactory;
use PHPinnacle\Langcat\Client;
use PHPinnacle\Langcat\Enum\StudentType;
use PHPinnacle\Langcat\Request\Authorization\AuthenticateRequest;
use PHPinnacle\Langcat\Request\Students\ListStudentsRequest;

$factory = new HttpFactory();
$client = new Client(
    'https://your-instance.langlion.com/api/v4',
    new HttpClient(),
    $factory,
    $factory,
);

$token = $client->authorization()->authenticate(
    AuthenticateRequest::make()
        ->clientId('client-id')
        ->clientSecret('client-secret'),
);

$students = $client
    ->withAccessToken($token->accessToken)
    ->students()
    ->all(
        ListStudentsRequest::make()
            ->page(1)
            ->perPage(20)
            ->type(StudentType::Lead)
            ->archived(false),
    );
bash
php examples/list-students.php 1 > students.jsonl
php examples/student-profile.php 387
php examples/group-lessons.php 12 '2026-09-01' '2026-10-01' > lessons.jsonl
bash
php examples/create-lead.php 1 'Ada' 'Example'
php examples/assign-student.php 12 387 '2026-09-07'