Download the PHP package znojil/heureka without Composer
On this page you can find all versions of the php package znojil/heureka. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package heureka
Znojil Heureka
A simple and modern PHP library for communicating with the Heureka API.
The library covers services for fetching reviews, the category tree, and the Verified by Customers (Ověřeno zákazníky) service.
🌐 Supported Regions
This library supports the following regions:
- Heureka.cz
- Heureka.sk
🔑 Service Activation
To use the Verified by Customers (Ověřeno zákazníky) service, you must first activate it here.
🚀 Installation
Install the library using Composer:
📖 Usage
1. Client Initialization
First, you need to create a client instance. The client requires a region (.cz or .sk) and an API key for services that need authentication.
2. Using a Custom HTTP Client
You can inject your own HTTP client implementation by passing it as the third argument to the Client constructor. This is useful for testing or for integrating with your application's existing HTTP layer (e.g., Guzzle, Symfony HTTP Client).
Your client must implement the Znojil\Heureka\Http\Client interface.
Your implementation must honor the Znojil\Heureka\Http\Option::* keys passed in $options (e.g. Option::Timeout — the ShopCertification order log request sets a short timeout) and must reject unknown string keys with an exception. Integer keys are raw CURLOPT_* constants — non-cURL implementations must reject them with an exception rather than silently ignore them, so that a consumer never ends up with options that silently don't apply.
3. Fetching the Category Tree
This service does not require an API key.
4. Fetching Shop Reviews
This service requires an API key. The response is an array of ShopReviewDTO objects.
5. Fetching Product Reviews
This service requires an API key. You can optionally set a date from which to fetch the reviews. The response is an array of ProductReviewDTO objects.
6. Sending an Order (Verified by Customers)
This service sends order information to the Verified by Customers (Ověřeno zákazníky) system. It requires an API key and uses the new v2 API.
For more details, see the official Heureka 'Verified by Customers' documentation.
⚠️ Error Handling
The client throws exceptions to help you identify the issue:
Znojil\Heureka\Exception\XmlParseException: When a feed response body cannot be parsed as XML.Znojil\Heureka\Exception\JsonException: When the ShopCertification response is not valid JSON.Znojil\Heureka\Exception\ClientException: For client-side errors (HTTP 4xx).Znojil\Heureka\Exception\ServerException: For server-side errors (HTTP 5xx).Znojil\Heureka\Exception\ResponseException: For other HTTP error codes.Znojil\Heureka\Exception\LogicException: If you try to call a service that requires an API key without one being set.Znojil\Heureka\Exception\InvalidArgumentException: For unknown HTTP client option keys.
All exceptions thrown by the library implement the
Znojil\Heureka\Exception\Exceptionmarker interface, so a single catch can cover them all.
📄 License
This library is open-source software licensed under the MIT license.