sylapi/feed-compari

Compari merchant feeds

Maintainers

Package info

github.com/sylapi/feed-compari

pkg:composer/sylapi/feed-compari

Statistics

Installs: 4 515

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-03-13 07:38 UTC

This package is auto-updated.

Last update: 2026-03-13 07:40:12 UTC


README

Latest Stable Version Total Downloads License PHP Version

PHP library for generating Compari merchant feed XML files. This package provides an easy way to create product feeds compatible with Compari shopping platform.

Requirements

  • PHP 8.0 or higher
  • sylapi/feeds ^1.0.0

Installation

Install the package via Composer:

composer require sylapi/feed-compari

Usage

<?php

require_once 'vendor/autoload.php';

use Sylapi\Feeds\FeedGenerator;
use Sylapi\Feeds\Compari\Feed;
use Sylapi\Feeds\Parameters;
use Sylapi\Feeds\Models\Product;

// Create feed generator
$feedGenerator = new FeedGenerator();
$feedGenerator->setFeed(new Feed(
    Parameters::create([
        'title' => 'My Store Products',
        'description' => 'Product feed for Compari comparison shopping',
        'link' => 'https://mystore.example.com/',
    ])
));

// Create and add products
$product = new Product();
$product->setName('Example Product')
        ->setPrice(99.99)
        ->setCurrency('PLN')
        ->setAvailability('in stock')
        ->setDescription('Product description...')
        ->setUrl('https://mystore.example.com/product/123')
        ->setImageUrl('https://mystore.example.com/images/product123.jpg');

$feedGenerator->appendProduct($product);

// Add more products...
// $feedGenerator->appendProduct($anotherProduct);

// Generate and save the feed
$feedGenerator->save();
echo "Feed saved to: " . $feedGenerator->filePath();

Development

Available Commands

Command Description
composer tests Run PHPUnit tests
composer phpstan Run PHPStan static analysis
composer coverage Generate PHPUnit coverage report in text format
composer coverage-html Generate PHPUnit coverage report in HTML format (saved to ./coverage/ directory)

Running Tests

# Run all tests
composer tests

# Run tests with coverage
composer coverage

# Generate HTML coverage report
composer coverage-html

Static Analysis

# Run PHPStan analysis
composer phpstan

License

This package is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.