Helper for handling changing variables in different environments
Known environment variables:
- <code>string iam_service_url</code> the Url to the IAM Service
- <code>string payment_service_url</code> the Url to the Payment Service
- <code>string locale</code> language code, use only 2 letters like 'en'
A filter holds information for filtering data via the API.
Example:
```
$filter = new Filter('created', '2018-10-23', '>=');
```
If you want to filter for `NULL` values, you can pass the string `'NULL'` as value.
A query represents a set of query parameters for a GET request
You should use it to pass query and filter parameters to the
Client's get* methods.
For example:
```
$myQuery = new Query();
$myQuery->set('foo', 'bar');
$myQuery->setPageSize(10);
$myQuery->addFilter(new Filter('field', 'value'));
```
For integrating the booking process into a partner platform, a widget is
available. Widgets are referenced by Widget-Hash.
You need to embed the Widget <code>/assets/js/widgetapi.js</code> into your
hostpage and use the <code>NextEventWidgetAPI</code> to interact with the widget.
### Embed Widget
```php
<?php
use NextEvent\PHPSDK\Client;
$appUrl = 'https://myapp.nextevent.com';
$credentials = [...];
$widgetHash = 's67fa757df4a76s5';
$client = new Client($appUrl, $credentials, $widgetHash);
// get Widget
$widget = $client->getWidget();
// embed Widget
echo $widget->generateEmbedCode($event_id);
```
### NextEventWidgetAPI
The <code>NextEventWidgetAPI</code> is a JavaSrcipt script, which you can use to
register Message Handlers. Therefore the script has to be included into the
hostpage.
Use <code>NextEventWidgetAPI</code> for retrieving the <code>order_id</code> and send
it to your server.
Use <code>NextEventWidgetAPI</code> to show your own payment step on
<code>current_step</code> message
```html
<script src="/assets/js/widgetapi.js"></script>
```
When the script is included the NextEventWidgetAPI is available by <code>window
.NextEventWidgetAPI</code>
```js
function custom_handler(data) {
// do something with the data
}
// handler can be added
window.NextEventWidgetAPI.addMessageHandler('current_step', custom_handler);
// and removed
window.NextEventWidgetAPI.removeMessageHandler('current_step', custom_handler);
```
### Widget Messages
#### current_step
This message is send on changing routes.
<code>step</code> current step a path
example data:
```js
{
step: '/event/42'
}
{
step: '/payment'
}
{
step: '/checkout'
}
```
#### basket_update
This message is send when the basket is updated
<code>order_id</code> id from current basket
example data:
```js
{
order_id: 5005
}
```