PHP code example of eduvo / php-api-library
1. Go to this page and download the library: Download eduvo/php-api-library 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/ */
eduvo / php-api-library example snippets
$client = new \Eduvo\Client('YOUR API TOKEN');
$ib_groups = $client->ib_groups->all();
foreach ($ib_groups as $ib_group) {
echo $ib_group->name . PHP_EOL;
}
$advisors = $client->ib_groups->advisors(YOUR_IB_GROUP_ID);
foreach ($advisors as $advisor) {
$teacher = $client->teachers->get($advisor->id);
echo $teacher->first_name . ' ' . $teacher->last_name . PHP_EOL;
}
$student_ids = $client->ib_groups->students(YOUR_IB_GROUP_ID);
foreach ($student_ids as $student_id) {
$student = $client->students->get($student_id);
echo $student->first_name . ' ' . $student->last_name . PHP_EOL;
}
$students = [STUDENT1_ID, STUDENT2_ID];
$response = $client->ib_groups->add_students(YOUR_IB_GROUP_ID, $students);
echo $response->status;
$students = [STUDENT1_ID, STUDENT2_ID];
$response = $client->ib_groups->remove_students(YOUR_IB_GROUP_ID, $students);
echo $response->status;
$classes = $client->classes->all();
foreach ($classes as $class) {
echo $class->name . PHP_EOL;
}
$class = $client->classes->get(10508262);
echo $class->name;
$student_ids = $client->classes->students(10753516);
foreach ($student_ids as $student_id) {
$student = $client->students->get($student_id);
echo $student->first_name . ' ' . $student->last_name . PHP_EOL;
}
$student_ids = [STUDENT1_ID, STUDENT2_ID];
$response = $client->classes->add_students(YOUR_CLASS_ID, $student_ids);
echo $response->status;
$student_ids = [STUDENT1_ID, STUDENT2_ID];
$response = $client->classes->remove_students(YOUR_CLASS_ID, $student_ids);
echo $response->status;
$parents = $client->parents->all();
foreach ($parents as $parent) {
echo $parent->email . PHP_EOL;
}
$parent = $client->parents->get(PARENT_ID);
echo $parent->email;
$parent = [
'email' => '[email protected] ',
'first_name' => 'Stepan',
'last_name' => 'Bander',
'child_ids' => [STUDENT1_ID]
];
$client->parents->create($parent);
$parent = [
'child_ids' => [STUDENT1_ID, STUDENT2_ID]
];
$client->parents->update(PARENT_ID, $parent);
$response = $client->parents->archive(PARENT_ID);
echo $response->status;
$response = $client->parents->unarchive(PARENT_ID);
echo $response->status;
$students = $client->students->all();
foreach ($students as $student) {
echo $student->email . PHP_EOL;
}
$student = $client->students->get(STUDENT_ID);
echo $student->email;
$student = [
'email' => '[email protected] ',
'first_name' => 'Kevin',
'last_name' => 'Epelbaum'
];
$client->students->create($student);
$student = [
'nationalities' => ['GB', 'US']
];
$client->students->update(STUDENT_ID, $student);
$response = $client->students->archive(STUDENT_ID);
echo $response->status;
$response = $client->students->unarchive(STUDENT_ID);
echo $response->status;
$teachers = $client->teachers->all();
foreach ($teachers as $teacher) {
echo $teacher->email . PHP_EOL;
}
$teacher = $client->teachers->get(TEACHER_ID);
echo $teacher->email;
$teacher = [
'email' => '[email protected] ',
'first_name' => 'John',
'last_name' => 'Epelbaum'
];
$client->teachers->create($teacher);
$teacher = [
'nationalities' => ['GB']
];
$client->teachers->update(TEACHER_ID, $teacher);
json
{
"vo/php-api-library": "1.*"
}
}
bash
composer