nickdekruijk / eduframe-php-client
A PHP Client for the Eduframe V1 API
dev-main
2022-03-25 10:53 UTC
Requires
- php: >=5.5.0
- ext-json: *
- guzzlehttp/guzzle: ~6.0|^7.0
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2024-12-25 16:46:24 UTC
README
PHP Client for Eduframe V1
Installation
This package is not puslished on packagist yet.
composer ..
Access token
Fetching published courses can be executed without an access token.
<?php require __DIR__ . '/vendor/autoload.php'; $connection = new \Eduframe\Connection();
However when accessing invoices or users an access token is required. An access token can be obtained by going to your profile page in the Eduframe admin dashboard.
$connection->setAccessToken( 'ACCESS_TOKEN' );
Normal actions
After you have set the api key, the data can be fetched as following:
<?php require __DIR__ . '/vendor/autoload.php'; $connection = new \Eduframe\Connection(); // Set this in case you need an access token for your requests. $connection->setAccessToken('ACCESSTOKEN'); // Set up a new Eduframe instance and inject the connection $client = new Eduframe\Client( $connection ); // Example: Get courses $courses = $client->courses()->all(); // Example: Get courses with includes in this case the course tabs $courses_with_tabs = $client->courses()->all(['include' => 'course_tab_contents.course_tab']); // Example: Fetch list of planned courses with meetings $planned_courses = $client->planned_courses()->all(['include' => 'meetings']); // Example: Fetch a single planned course by id $planned_course = $client->planned_courses()->find(123456789); // Example: Create a lead $lead = $client->leads(); $lead->company_name = 'Drieam'; $lead->first_name = 'Luuk'; $lead->middle_name = 'van'; $lead->last_name = 'Hulten'; $lead->address = $client->addresses([ 'address' => 'Don Boscostraat 4', 'postal_code' => '5611 KW', 'city' => 'Eindhoven', 'country' => 'NL', ]); $lead->save();
Code example
See for example: example.php