Download the PHP package baraja-core/heureka-feed without Composer
On this page you can find all versions of the php package baraja-core/heureka-feed. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download baraja-core/heureka-feed
More information about baraja-core/heureka-feed
Files in baraja-core/heureka-feed
Package heureka-feed
Short Description Smart Heureka feed adapter.
License
Homepage https://github.com/baraja-core/heureka-feed
Informations about the package heureka-feed
Heureka Feed Adapter
Smart PHP library for generating valid Heureka.cz XML product feeds. The package provides automatic feed generation, category management, product validation, and seamless integration with Nette Framework.
🎯 Key Principles
- Automatic feed generation at the
/xml/heureka-feed.xmlendpoint - Built-in category management with official Heureka category tree support
- Strict input validation for all product attributes (EAN-13, ISBN-10/13, URLs, etc.)
- Support for all major Czech delivery providers (PPL, DPD, Zasilkovna, GLS, etc.)
- Caching layer for category data to minimize external API calls
- Extensible architecture with custom description renderers and product loaders
- Full Nette Framework integration via DIC extension
🏗️ Architecture
The package follows a clean separation of concerns with the following main components:
📦 Components Overview
| Component | Description |
|---|---|
HeurekaFeedExtension |
Nette DI extension that registers all services and sets up automatic feed endpoint |
HeurekaManager |
Main orchestrator that triggers feed rendering |
FeedRenderer |
Converts product data to valid Heureka XML format |
ProductLoader |
Interface you implement to provide your products |
CategoryManager |
Manages Heureka's official category tree with caching |
HeurekaProduct |
Entity representing a single product with all Heureka attributes |
Category |
Entity representing a Heureka category with parent hierarchy |
Delivery |
Entity representing delivery options with predefined carrier constants |
DescriptionRenderer |
Interface for custom product description formatting |
Helpers |
Utility class with EAN-13 and ISBN-10/13 validation methods |
📦 Installation
It's best to use Composer for installation, and you can also find the package on Packagist and GitHub.
To install, simply use the command:
You can use the package manually by creating an instance of the internal classes, or register a DIC extension to link the services directly to the Nette Framework.
Nette Framework Integration
Register the extension in your config.neon:
The extension automatically:
- Registers
HeurekaManager,CategoryManager, andFeedRendereras services - Sets up the feed endpoint at
/xml/heureka-feed.xml - Configures Markdown description renderer if
baraja-core/markdown-latte-filteris available
🚀 Basic Usage
1. Implement the ProductLoader Interface
Create a class that implements ProductLoader to provide your products:
2. Register Your ProductLoader
In your config.neon:
The FeedRenderer will automatically detect and use your ProductLoader implementation.
3. Access the Feed
Once configured, the XML feed is automatically available at:
📋 HeurekaProduct Entity
The HeurekaProduct entity supports all standard Heureka feed attributes:
Required Attributes (Constructor)
| Attribute | Type | Description |
|---|---|---|
itemId |
string | Unique product identifier (max 36 chars, alphanumeric with - and _) |
product |
string | Product name for matching (max 200 chars) |
productName |
string | Exact product name displayed to users (max 200 chars) |
url |
string | Absolute URL to product detail page (max 300 chars) |
priceVat |
float | Price including VAT |
category |
Category | Heureka category entity |
manufacturer |
string | Manufacturer/brand name |
Optional Attributes (Setters)
Image Requirements
- Minimum size: 20x20 pixels
- Recommended size: 175x175 pixels
- Maximum size: 4096x4096 pixels (2 MB)
- Video URL: Only YouTube links are supported (youtube.com or yt.be domains)
Parameter Handling
Parameters are automatically converted:
- Boolean values become
"ano"/"ne" - Numeric values must include units (e.g.,
"100 g", not just100)
🚚 Delivery Options
The Delivery entity supports all major Czech carriers:
Supported Carriers
| Constant | Carrier |
|---|---|
CESKA_POSTA |
Ceska posta - Balik Do ruky |
CESKA_POSTA_NAPOSTU_DEPOTAPI |
Ceska posta - Balik Na postu |
CESKA_POSTA_DOPORUCENA_ZASILKA |
Ceska posta - Doporucena zasilka |
PPL |
PPL |
DPD |
DPD |
DPD_PICKUP |
DPD Pickup |
DHL |
DHL |
GLS |
GLS |
GEIS |
Geis |
ZASILKOVNA |
Zasilkovna |
BALIKOVNA_DEPOTAPI |
Balikovna |
UPS |
UPS |
FEDEX |
FedEx |
TNT |
TNT |
TOPTRANS |
TOPTRANS |
WEDO |
WeDo (IN TIME & Ulozhenka) |
VLASTNI_PREPRAVA |
Custom delivery |
FOFR |
FOFR |
DSV |
DSV |
HDS |
HDS |
GEBRUDER_WEISS |
Gebruder Weiss |
SEEGMULLER |
Seegmuller |
RABEN_LOGISTICS |
Raben Logistics |
CSAD_LOGISTIK_OSTRAVA |
CSAD Logistik Ostrava |
📁 Category Management
The CategoryManager provides access to Heureka's official category tree:
Category Entity
Custom Category Feed URL
By default, categories are fetched from https://www.heureka.cz/direct/xml-export/shops/heureka-sekce.xml. You can change this:
Caching
- Category feed is cached for 8 hours
- Selectbox tree is cached for 1 hour
- Uses Nette Caching with configurable storage
🎨 Custom Description Renderer
Implement DescriptionRenderer to customize how product descriptions are processed:
Register your implementation:
Then set it on the FeedRenderer:
Built-in Markdown Renderer
If baraja-core/markdown-latte-filter is installed, the BarajaMarkdownDescriptionRenderer is automatically registered. It converts Markdown to plain text (strips HTML tags after rendering).
🔧 Validation Helpers
The Helpers class provides validation utilities:
These validators are automatically used when setting EAN or ISBN on HeurekaProduct and will throw InvalidArgumentException for invalid values.
🔍 Generated XML Structure
The generated feed follows Heureka's XML specification:
⚠️ Error Handling
The package performs extensive validation and throws exceptions for invalid data:
InvalidArgumentException- For invalid attribute values (URLs, EAN, ISBN, lengths, etc.)LogicException- For duplicateItemIdvalues in the feedRuntimeException- WhenProductLoaderis not configured
All validation errors include descriptive messages to help identify the issue.
📝 Manual Usage (Without Nette)
👤 Author
Jan Barasek - https://baraja.cz
📄 License
baraja-core/heureka-feed is licensed under the MIT license. See the LICENSE file for more details.
All versions of heureka-feed with dependencies
baraja-core/xml-to-php-array Version ^2.0
baraja-core/selectbox-tree Version ^2.1
spatie/array-to-xml Version ^3.0
nette/utils Version ^3.2
nette/http Version ^3.1
nette/di Version ^3.0
nette/caching Version ^3.1
nette/application Version ^3.1