https://github.com/paravibe/gototraining
https://github.com/paravibe/gototraining
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/paravibe/gototraining
- Owner: paravibe
- License: mit
- Created: 2020-07-13T12:07:50.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-13T07:49:39.000Z (over 1 year ago)
- Last Synced: 2025-10-21T02:21:34.207Z (9 months ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GoToTraining PHP wrapper
[](https://github.com/paravibe/gototraining/releases)
[](https://travis-ci.org/paravibe/gototraining)
[](https://packagist.org/packages/paravibe/gototraining)
## Installation
`composer require paravibe/gototraining`
## How to use
### Initialize client
`$client = new \LogMeIn\GoToTraining\Client($access_token, $values);`
Where `$access_token` is a token retrived during authorization procedure - https://developer.goto.com/guides/HowTos/03_HOW_accessToken/
and `$values` are response data that contain:
* account_key
* account_type
* email
* firstName
* lastName
* organizer_key
Use any method described here https://developer.goto.com/GoToTrainingV1
by passing proper HTTP method and endpoint to `createRequest()` method.
### GET/DELETE methods
```php
$get = $client->createRequest('GET', "organizers/{$organizer_key}/trainings")->execute();
$data = $get->getDecodedBody();
```
### POST/PUT methods
```php
$post_data = array(
'name' => 'Training',
'description' => 'Test API integration',
'times' => [
[
'startDate' => '2021-03-02T12:00:00Z',
'endDate' => '2021-03-02T13:00:00Z',
]
],
'timeZone' => 'Europe/Kiev',
);
$new = $client->createRequest('POST', "organizers/{$organizer_key}/trainings")
->attachBody($post_data)
->execute();
```