定制 znojil/heureka 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

znojil/heureka

Composer 安装命令:

composer require znojil/heureka

包简介

📦 A simple and modern PHP library for communicating with the Heureka API.

README 文档

README

Latest Stable Version PHP Version Require License Tests

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:

composer require znojil/heureka

📖 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.

use Znojil\Heureka\Client;
use Znojil\Heureka\Enum\Region;

// For Heureka.cz
$clientCz = new Client(Region::Cz, 'YOUR_API_KEY_FOR_CZ');

// For Heureka.sk
$clientSk = new Client(Region::Sk, 'YOUR_API_KEY_FOR_SK');

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.

use Znojil\Heureka\Client;
use Znojil\Heureka\Enum\Region;
use Znojil\Heureka\Http\Client as HeurekaHttpClient;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;

// A custom HTTP client implementation example
class MyCustomHttpClient implements HeurekaHttpClient{
	public function send(string $method, UriInterface|string $uri, array $headers = [], mixed $data = null, array $options = []): ResponseInterface{
		// Your logic to send the request...
		// For example, using Guzzle:
		// $guzzleClient = new \GuzzleHttp\Client;
		// return $guzzleClient->request($method, $uri, [...]);
	}
}

$customHttpClient = new MyCustomHttpClient;
$client = new Client(Region::Cz, 'YOUR_API_KEY', $customHttpClient);

3. Fetching the Category Tree

This service does not require an API key.

use Znojil\Heureka\Feed\Request\GetCategoryTreeRequest;

$request = new GetCategoryTreeRequest;
$categoryTreeCollection = $clientCz->send($request);

foreach($categoryTreeCollection as $tree){
	$tree; // CategoryTreeDTO
}

4. Fetching Shop Reviews

This service requires an API key. The response is an array of ShopReviewDTO objects.

use Znojil\Heureka\Feed\Request\GetShopReviewsRequest;

$request = new GetShopReviewsRequest;
$reviews = $clientCz->send($request);

foreach($reviews as $review){
	$review; // ShopReviewDTO
}

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.

use Znojil\Heureka\Feed\Request\GetProductReviewsRequest;

// Without a date filter
$requestAll = new GetProductReviewsRequest;
$allReviews = $clientCz->send($requestAll);

// Only reviews since yesterday
$yesterday = new \DateTimeImmutable('yesterday');
$requestSince = new GetProductReviewsRequest($yesterday);
$recentReviews = $clientCz->send($requestSince);

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.

use Znojil\Heureka\ShopCertification\LogOrderDTO;
use Znojil\Heureka\ShopCertification\OrderLogRequest;

// 1. Create a DTO with the order data
$orderDto = new LogOrderDTO(
	email: 'customer@email.com',
	orderId: 'ORD2024001',
	productItemIds: ['AB-123', 'CD-456']
);

// 2. Create the request and send it
$request = new OrderLogRequest($orderDto);
$response = $clientCz->send($request);

if($response->isSuccessful()){
	echo "Order was successfully logged.";
}

For more details, see the official Heureka 'Verified by Customers' documentation.

⚠️ Error Handling

The client throws exceptions on failed HTTP requests to help you identify the issue:

  • 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.

📄 License

This library is open-source software licensed under the MIT license.

znojil/heureka 适用场景与选型建议

znojil/heureka 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「client」 「sdk」 「heureka」 「reviews」 「znojil」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 znojil/heureka 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 znojil/heureka 我们能提供哪些服务?
定制开发 / 二次开发

基于 znojil/heureka 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 30
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 16
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-03