PHP server integration
Install
PHP 8.1+ with cURL enabled. Save classroom.php beside vendor/, configure the environment and run php classroom.php.
composer require eduskit/server-sdk-php:0.1.5
The Composer package is eduskit/server-sdk-php; its namespace is Eduskit. Calls are synchronous and use associative arrays.
Create a classroom and issue a student credential
Set the backend environment variables. This example uses separate teacher and student accounts. Replace the example avatar URLs with accessible resources. Each run creates a new classroom; originId only makes user registration idempotent.
<?php
require __DIR__ . '/vendor/autoload.php';
use Eduskit\Eduskit;
use Eduskit\EduskitError;
function required(string $name): string {
$value = getenv($name);
if ($value === false || trim($value) === '') {
throw new InvalidArgumentException('Missing ' . $name);
}
return trim($value);
}
function createDemoClassroom(): array {
$sdk = new Eduskit([
'timeoutMs' => 10000,
'client' => [
'baseUrl' => required('EDU_SERVER_URL'),
'appId' => required('EDU_APP_ID'),
'appKey' => required('EDU_APP_KEY'),
'appSecret' => required('EDU_APP_SECRET'),
],
]);
$teacher = $sdk->client->users->register([
'originId' => 'demo-teacher-001', 'nickname' => 'Teacher',
'avatar' => 'https://example.com/teacher.png',
]);
$student = $sdk->client->users->register([
'originId' => 'demo-student-001', 'nickname' => 'Student',
'avatar' => 'https://example.com/student.png',
]);
$classroom = $sdk->client->classrooms->create([
'name' => 'SDK integration',
'startsAt' => gmdate('Y-m-d\TH:i:s\Z', time() + 15 * 60),
'durationMinutes' => 60,
'teacherEduUserId' => $teacher['eduUserId'],
'studentEduUserIds' => [$student['eduUserId']],
'joinPolicy' => 'invite_only',
]);
$token = $sdk->client->auth->issueToken([
'eduUserId' => $student['eduUserId'], 'originId' => 'demo-student-001', 'expiresIn' => 3600,
]);
return [
'appId' => $token['appId'], 'classroomId' => $classroom['classroomId'],
'userId' => $student['eduUserId'], 'userToken' => $token['accessToken'],
'expiresAt' => $token['expiresAt'],
];
}
try {
$entry = createDemoClassroom();
echo $entry['classroomId'] . ' ' . $entry['userId'] . PHP_EOL;
} catch (EduskitError $error) {
error_log($error->errorCode . ' ' . $error->status . ' ' . $error->traceId);
exit(1);
}
Return userToken through your entry endpoint to the authenticated student. In production, create classrooms during scheduling and issue tokens when users enter.
Calling conventions
$sdk->client / $sdk->whiteboardClient. Methods and JSON fields use camelCase. timeoutMs is in milliseconds.
See Classroom API for members, permissions, courseware and start/end methods. See Whiteboard server integration for recordings and conversion, and Errors and troubleshooting for failure and retry behavior.
Application and tenant APIs
Source builds provide 50 application-authenticated HTTP routes through client, including users, classrooms, courseware libraries, live assets, and diagnostics. See application business APIs and workflow examples. The separate tenant management client uses tenant sessions for account, application, dashboard, and billing operations. The new methods require the matching server-api deployment and a source build; public 0.1.5 packages do not include them.