Classes, interfaces and traits

WebhookMessage

A webhook message comes from the platform the app runs on and contains data, which can be used for various processes.

The instance of this class should be used, to verify content of the incoming message to make your platform more secure. In order to verify the incoming message, you have to know the secret, you configured on the webhook in the NextEvent App. Example: ``` try { $gate = WebhookMessage::current()->verify()->getModel(Gate::class); // Do something... } catch (WebhookMessageException $exception) { // Handle this } ```
« More »

Classes, interfaces and traits

Client

SDK Client - main class

Entry point for the SDK exposing functions to interact with the NextEvent API. ### Booking Process and Payment Process 0. Authorize SDK by creating Client instance with credentials 1. <code>getEvents()</code> List events 2. <code>getWidget($hash)->generateEmbedCode($eventId)</code> Embed widget for specific event 3. Get orderId from the widget by postMessage 4. <code>getBasket($orderId)</code> checkout the basket 5. <code>authorizeOrder($orderId)</code> start payment process 6. <code>settlePayment($payment, $customer, $transactionId)</code> settle payment 7. <code>getTicketDocuments($orderId)</code> get TicketDocuments with download urls ### Rebooking 1. <code>rebookOrder()</code> create rebooking basket 2. <code>getWidget($hash)->generateEmbedCode(['basket' => $basket])</code> Embed widget with rebooking basket. 3. Complete order as in regular booking process ### Cancellation 1. <code>requestCancellation()</code> request cancellation authorization for a given order 2. <code>settleCancellation()</code> settle cancellation with the authorization data ### Entrance check information 1. <code>getAccessCodes($query)</code> get a collection of AccessCodes 2. <code>getGate($gateId)</code> get a Gate 3. <code>getGates($query)</code> get a collection Gates 4. <code>getDevice($deviceId)</code> get a Device 5. <code>getDevices($query)</code> get a collection of Devices 6. <code>getScanLogs($query)</code> get a collection of ScanLogs ### Price and category information 1. <code>getBaseCategories($query)</code> get a collection of BaseCategories 2. <code>getCategories($query)</code> get a collection of Categories 3. <code>getBasePrices($query)</code> get a collection of BasePrices 4. <code>getPrices($query)</code> get a collection of Prices ### Persistance 1. <code>createEvent($event)</code> create a new Event 2. <code>createBaseCategory($categories)</code> create new BaseCategories and Categories 3. <code>createBasePrice($prices)</code> create new BasePrices and Prices 4. <code>updateBaseCategory($categories)</code> update BaseCategories and its Categories 5. <code>updateBasePrice($prices)</code> update BasePrices and its Prices
« More »

Classes, interfaces and traits

Spawnable

A class which implements the Spawnable interface can be used to define whether a Model can be created, without having specific properties set, such as a unique identifier.

« More »

AccessCode

Access code model

An access code is used in the entrance check process. Each access code owns a (bar)code, a category id and a state. A [Gate](../classes/NextEvent.PHPSDK.Model.Gate.html) is responsible for invalidating, i.e. modifying the `entry_state`, of such an access code.
« More »

AccessCodeCollection

The access code collection holds access code instances.

An instance of this collection can update the entry state of all access codes inside of it with one single API request.
« More »

APIResponse

Class APIResponse

A wrapper class for responses returned by GuzzleHttp. Adds utility functions used by the SDK
« More »

BaseCategory

BaseCategory model

Provides the structure for a base category record. Base categories are categories which can not be booked and are never linked to an order item. Base categories are internally used to create category records. All values which are set for a base category will automatically be applied to the related category records.
« More »

BasePrice

BasePrice model

Provides the structure for a base price record. A base price is a price which applies it's data to actual price records. A base price is never linked to a category record. It rather links to a [BaseCategory](../classes/NextEvent.PHPSDK.Model.BaseCategory.html). Just like a base category, a base price is never linked to an order item.
« More »

Basket

Basket model

Represents a basket model retrieved from the API
« More »

BasketItem

BasketItem model

Model class representing a single item (ticket) of a NextEvent basket
« More »

CancellationRequest

Cancellation request model

Represents a cancellation request for a given order. Can be used to confirm cancellation in a second step.
« More »

Category

Category model

Struct for a category record assigned to an order/basket item.
« More »

Collection

A collection holds instances of models by converting them from raw data.

It has meta information about the total amount of items, pages and references to other pages. Further more it allows to iterate over all total items, by simply fetching the next page if the bounds of the current page have been reached. If you want to fetch the next page manually, you can call [Collection::fetchNextPage()](../classes/NextEvent.PHPSDK.Model.Collection.html#method_fetchNextPage). This will fetch the next page, if it is available and apply the content to this collection. In order to fetch a specific page and apply it to the collection, you can fetch it with the rest client and then apply it via [Collection::setData()](../classes/NextEvent.PHPSDK.Model.Collection.html#method_setData). Whether you want to reset the current data or not can be controlled with the flag `reset`.
« More »

DateTime

Class DateTime

Extend the default DateTime class with a flag indicating that it only represent a date and the time should be ignored.
« More »

Device

Device model

A device entity represents a real world device. It holds information such as the device UUID, platform(os) and it's version and the device name. A device can also tell on which gate it is logged in and when it has been logged in the last time.
« More »

DiscountCode

Discount code model

Struct for a discount code record assigned to an order/basket item or a DiscountGroup relation.
« More »

DiscountGroup

Discount group model

Struct for a discount group registered in the system.
« More »

Event

Event model

Model class for an event record registered in NextEvent. Provides simplified access to event title, details, start/end dates, etc.
« More »

Gate

Gate model

A gate represents an entity which is responsible for invalidating access codes. It can only invalidate those access codes whose category id matches one of the gate's category ids.
« More »

GeoCoordinates

GeoCoordinates model

Struct for a pair of geographic coordinates as defined in the World Geodetic System (WGS 84).
« More »

Location

Location model

Represents a geographic place, like the location of an event.
« More »

Model

Base class for model classes

Data structures retrieved from the NextEvent API are wrapped into dependants of this class in order to provide a well-defined struct for accessing these informations. With the Serializable interface implemented, all models can easily be serialized and stored in session data.
« More »

MutableModel

A mutable model is a model whose source attributes can be changed.

An instance of a mutable model provides setters for any property. This means you can call e.g. `$model->setFoo($val)` which will will store the value at the index `foo` in the internal source array. You can also override the whole source at once with the [MutableModel::setSource()](../classes/NextEvent.PHPSDK.Model.MutableModel.html#method_setSource).
« More »

Order

Order model

Represents an order record retrieved from the API.
« More »

OrderDocument

OrderDocument model

Represents a printable PDF document attached to an order
« More »

OrderItem

OrderItem model

Model class representing a single item of a NextEvent order
« More »

Organization

Organization model

Represents an organization entity
« More »

Payment

Payment model

Represents a payment authorization record issued by the API. Can be used to process payment and finally settle orders.
« More »

PostalAddress

Class PostalAddress

Represents an postal address data structure
« More »

Price

Price model

Model class exposing price properties like title, price, currency
« More »

ScanLog

ScanLog model

A scan log holds entry information of an access code. Those information contain process time, gate which scanned the code and which device has done it. Furthermore it holds connection state information and the validation message. This model can be used to analyze the entrance checks.
« More »

Seat

Seat information model

Struct for seat information assigend an order/basket item.
« More »

Ticket

Ticket model

Model class representing a booked ticket
« More »

TicketDocument

TicketDocument model

Represents a printable PDF document attached to a ticket
« More »

Classes, interfaces and traits

Client

Utility class for connecting to a REST API

« More »

HALResponse

Class HALResponse

A wrapper class for Responses returned by GuzzleHttp. The Responses are parsed as HAL+JSON and made accessible by this class.
« More »

Classes, interfaces and traits

IAMClient

Client for the IAM service API

```php // Get AccessToken by IAM <?php use NextEvent\PHPSDK\Client; use NextEvent\PHPSDK\Auth\IAMClient; $credentials = ['user', 'password', 'scope']; // Your Credentials $client = new Client($appUrl, $credentials, $widgetHash); // stand alone $iam_client = new IAMClient($credentials, $cache); $token = $iam_client->getToken(); ``` With the Token you can authorize requests to the NextEvent application by setting the <code>Authorization</code> Header. ```php $http->get( $url, ['headers' => [ 'Authorization' => $token->getAuthorizationHeader() ]]); ```
« More »

PaymentClient

Utility class for connecting to NextEvent's Payment Service API

« More »

Token

Token model

Parse Token issued by the IAMClient and provide some helper functions
« More »

Classes, interfaces and traits

Env

Class Env

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'
« More »

Filter

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.
« More »

Logger

Class Logger

This is only the Wrapper for a PSR Logger and not the actual Logger. Implements some convenience functions for better logging.
« More »

Query

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')); ```
« More »

Widget

Booking widget embedding utility

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 } ```
« More »

Classes, interfaces and traits

LogContextInterface

Interface LogContextInterface

General Interface used to provide function to convert implementor class to an array, which can be used for the log context.
« More »

Classes, interfaces and traits

StoreInterface

StoreInterface for implementing a key-value store

Provide own Cache for performance improvements. For example saving Session between multiple calls ```php // cache adapter <?php use NextEvent\PHPSDK\Store\StoreInterface; class MyCache implements StoreInterface { public function set($key, $value) { // your implementation } public function get($key) { // your implementation } public function clear() { // your implementation } } ?> // initialize <?php $my_cache = new MyCache(); // on initialize $ne_client = new \NextEvent\PHPSDK\Client($appUrl, $credentials, $widgetHash, $my_cache); // or $ne_client->setCache($my_cache); ?> ```
« More »

MemoryStore

Stores data in memory as long as process is active

« More »

OpcacheStore

Implements StoreInterface and stores its data in a temp file.

If __opcache__ is available, us this to cache temp file for performance improvement.
« More »

Classes, interfaces and traits

AccessCodesNotFoundException

Thrown when the requested access codes could not be found

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

AccessCodeValidateException

Thrown when an access code can not be validated.

« More »

APIResponseException

Generic Exception encapsulating an API error response

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

BasketEmptyException

Thrown when a basket could not be found or is expired

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

CollectionException

Thrown by a collection instance.

« More »

DeviceException

Thrown while searching for existing devices.

« More »

DeviceLoginException

Thrown when a device could not been logged in.

« More »

DeviceLogoutException

Thrown when a device could not been logged out.

« More »

DeviceNotFoundException

Thrown when the requested device could not be found

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

EntityNotFoundException

Thrown when the requested entity could not be found on the backend

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

GateNotFoundException

Thrown when the requested gate could not be found

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

InvalidArgumentException

Thrown when a constructor or method received invalid arguments

« More »

InvalidBaseCategoryException

Thrown by a base price model when assigning the wrong base category.

« More »

InvalidModelDataException

Thrown when a model got invalid data for construction

« More »

InvalidStoreException

Thrown when a given object doesn't implement the NextEvent\PHPSDK\Store\StoreInterface

« More »

MissingDocumentException

Thrown when the requested ticket documents are not yet available

« More »

NotAuthenticatedException

SDK Client ist not authenticated yet

« More »

NotAuthorizedException

SDK Client is not authorized for this API request

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

OrderItemNotFoundException

Thrown when the requested order/basket item couldn't be found or if the basket expired

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

OrderNotFoundException

Thrown when the requested order could not be found or basket is expired

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

PaymentNotFoundException

Thrown when referred payment authorization can't be found or is expired

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

QueryException

Thrown when query related operations could not been executed.

« More »

ScanLogsNotFoundException

Thrown when the requested scan logs could not be found

Thrown when a request to the NextEvent API failed with an error response. The exception provides extensive information about the request sent, the response received and the reasons which it didn't succeed. Use the toLogContext() or dumpAsString() methods for logging.
« More »

TicketNotFoundException

Thrown when tickets are not yet available for the given order

« More »

WebhookMessageException

Thrown by a webhook message instance.

« More »