wearepixel/laravel-google-shopping-feed

Laravel Google Shopping Feed
34,156 6
Install
composer require wearepixel/laravel-google-shopping-feed
Latest Version:5.1.1
PHP:>=8.4
License:MIT
Last Updated:Sep 29, 2026
Links: GitHub  ·  Packagist
Maintainer: wearepixel

Laravel Google Shopping Feed

Latest Version on Packagist Tests PHP Version Total Downloads License

A simple package to easily create an XML feed for Google Merchant Center to parse and retrieve your products.

We recommend adding this to an API controller and generating it on the fly so your feed is always up to date.

Requirements

  • PHP 8.4+
  • Laravel 10, 11, or 12

Installation

composer require wearepixel/laravel-google-shopping-feed

Usage

use Wearepixel\LaravelGoogleShoppingFeed\LaravelGoogleShoppingFeed;

$feed = LaravelGoogleShoppingFeed::init(
    title: 'My Store',
    description: 'My store product feed',
    link: 'https://mystore.com',
);

$feed->addItem([
    'id'           => 'item_001',
    'title'        => 'Blue Nikes',
    'link'         => 'https://mystore.com/products/blue-nikes',
    'g:price'      => '29.99 AUD',
    'g:image_link' => 'https://mystore.com/images/blue-nikes-001.jpg',
]);

return $feed->generate();

Required item fields

Field Description
id Unique product identifier
title Product name
link URL to the product page
g:price Price including currency code (e.g. 29.99 AUD)
g:image_link URL to the main product image

Any additional fields supported by the Google Product Data Specification can be passed alongside the required fields.

Methods

LaravelGoogleShoppingFeed::init(string $title, string $description, string $link): static

Creates a new feed instance with channel metadata.

$feed->addItem(array $item): void

Adds a product to the feed. Throws MissingRequiredFieldException if any required field is absent.

$feed->toXml(): string

Returns the feed as an XML string.

$feed->generate(): Response

Returns an HTTP response with the XML content and application/rss+xml content type. Suitable for returning directly from a controller.

Testing

composer test

License

MIT

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

413,412,504 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released PHP Laravel License
5.1.1 >=8.4 10.*|11.*|12.*|13.* MIT
5.1.0 >=8.4 10.*|11.*|12.*|13.* MIT
5.0.0 >=8.3 10.*|11.*|12.* MIT
4.0.0 8.*|9.*|10.*|11.* MIT
3.0.0 8.*|9.* MIT