developermarius / eventim-public-api
Wrapper for the Eventim public api
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=8.1
- developermarius/rp-utils: dev-main
- guzzlehttp/guzzle: ^7.0
This package is auto-updated.
Last update: 2024-10-31 17:36:20 UTC
README
This is a simple wrapper for the Eventim Public Api. It is written in PHP and provides a simple way to access the Eventim Public Api.
The Eventim Public Api is a RESTful API that provides access to the Eventim products through its search functionality.
After I did some simple analysis on the Eventim Public Api, I documented some components of the API in a gist. You can find the gist here.
Disclaimer before using this client: please ensure that you have the permissions from the Website Owner.
Installation
To install this library, you need to have Composer installed on your system. If you don't have it installed, you can download it from here.
Once you have Composer installed, you can install the library by running the following command in your terminal:
composer require developermarius/eventim-public-api
Usage
Initialization
First, you need to import the EventimClient
class and create a new instance of it.
use developermarius\eventim\publicapi\EventimClient; $client = new EventimClient();
Searching for Products
To search for products, you can use the search
method. This method accepts an optional EventimSearchQuery
object. If no query object is provided, a default one will be used.
use developermarius\eventim\publicapi\models\EventimSearchQuery; $query = EventimSearchQuery::new()->categories(array( EventimCategoryType::HUMOR, EventimCategoryType::CONCERT ))->cityNames(array( 'Frankfurt am Main' )); $response = $client->search($query);
The search
method returns an EventimSearchResponse
object, which contains the search results.
Paginating Search Results
To paginate through search results, you can use the paginateSearch
method. This method accepts a callback function, an optional EventimSearchQuery
object, and an optional sleep time between requests.
$allProducts = $client->paginateSearch(function($response) { // Process each page of results here }, $query, 2);
Limitations
Please note that due to limitations on the Eventim side, this library cannot handle page numbers greater than 102. If you try to access a page number greater than 102, an exception will be thrown.
Contributing
Contributions are welcome! Please feel free to submit a pull request.
License
This library is open-sourced software licensed under the MIT license.