wearepixel/laravel-facebook-feed 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

wearepixel/laravel-facebook-feed

最新稳定版本:2.0.0

Composer 安装命令:

composer require wearepixel/laravel-facebook-feed

包简介

Laravel Facebook Feed

README 文档

README

Latest Version on Packagist Tests PHP Version Total Downloads License

A simple package to easily create an XML feed for the Facebook Catalog API 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-facebook-feed

Usage

use Wearepixel\LaravelFacebookFeed\LaravelFacebookFeed;

$feed = LaravelFacebookFeed::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',
    'price'      => '29.99 AUD',
    '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
price Price including currency code (e.g. 29.99 AUD)
image_link URL to the main product image

Any additional fields supported by the Facebook Product Feed Specification can be passed alongside the required fields.

Methods

LaravelFacebookFeed::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

统计信息

  • 总下载量: 2.04k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固