PHPackages                             baraja-core/heureka-feed - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. baraja-core/heureka-feed

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

baraja-core/heureka-feed
========================

Smart Heureka feed adapter.

v2.2.0(4y ago)321.8k2PHPPHP ^8.0CI failing

Since Jan 2Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/baraja-core/heureka-feed)[ Packagist](https://packagist.org/packages/baraja-core/heureka-feed)[ Docs](https://github.com/baraja-core/heureka-feed)[ RSS](/packages/baraja-core-heureka-feed/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (17)Versions (15)Used By (2)

Heureka Feed Adapter
====================

[](#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
----------------

[](#-key-principles)

- **Automatic feed generation** at the `/xml/heureka-feed.xml` endpoint
- **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
---------------

[](#️-architecture)

The package follows a clean separation of concerns with the following main components:

```
┌─────────────────────────────────────────────────────────────────┐
│                    HeurekaFeedExtension                         │
│              (Nette DI Container Extension)                     │
└─────────────────────┬───────────────────────────────────────────┘
                      │ registers
                      ▼
┌─────────────────────────────────────────────────────────────────┐
│                      HeurekaManager                             │
│                   (Main Entry Point)                            │
└─────────────────────┬───────────────────────────────────────────┘
                      │ uses
                      ▼
┌─────────────────────────────────────────────────────────────────┐
│                       FeedRenderer                              │
│              (XML Output Generation)                            │
├─────────────────────┬───────────────────────────────────────────┤
│                     │                                           │
│   ┌─────────────────▼─────────────────┐                         │
│   │        ProductLoader              │◄──── Your Implementation│
│   │         (Interface)               │                         │
│   └─────────────────┬─────────────────┘                         │
│                     │ returns                                   │
│   ┌─────────────────▼─────────────────┐                         │
│   │       HeurekaProduct[]            │                         │
│   │          (Entities)               │                         │
│   └───────────────────────────────────┘                         │
│                                                                 │
│   ┌───────────────────────────────────┐                         │
│   │     DescriptionRenderer           │◄──── Optional           │
│   │         (Interface)               │                         │
│   └───────────────────────────────────┘                         │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│                     CategoryManager                             │
│        (Heureka Category Tree Management)                       │
├─────────────────────────────────────────────────────────────────┤
│  • Fetches official category XML from Heureka                   │
│  • Caches data for 8 hours                                      │
│  • Provides tree-structured selectbox data                      │
└─────────────────────────────────────────────────────────────────┘

```

### 📦 Components Overview

[](#-components-overview)

ComponentDescription`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
--------------

[](#-installation)

It's best to use [Composer](https://getcomposer.org) for installation, and you can also find the package on [Packagist](https://packagist.org/packages/baraja-core/heureka-feed) and [GitHub](https://github.com/baraja-core/heureka-feed).

To install, simply use the command:

```
$ composer require baraja-core/heureka-feed
```

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

[](#nette-framework-integration)

Register the extension in your `config.neon`:

```
extensions:
    heurekaFeed: Baraja\Heureka\HeurekaFeedExtension
```

The extension automatically:

- Registers `HeurekaManager`, `CategoryManager`, and `FeedRenderer` as services
- Sets up the feed endpoint at `/xml/heureka-feed.xml`
- Configures Markdown description renderer if `baraja-core/markdown-latte-filter` is available

🚀 Basic Usage
-------------

[](#-basic-usage)

### 1. Implement the ProductLoader Interface

[](#1-implement-the-productloader-interface)

Create a class that implements `ProductLoader` to provide your products:

```
