drieam / eduframe-php-client
A PHP Client for the Eduframe V1 API
Installs: 1 544
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 8
Forks: 6
Open Issues: 1
Requires
- php: >=7.0.0
- ext-json: *
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
README
DISCLAIMER: This is not a full representation of the Eduframe api. Feel free to open a pull request for adding missing endpoints and properties.
Installation
This package is puslished on packagist.
composer require drieam/eduframe-php-client
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