简单的 RSS 2.0 生成器

v1.0 2020-05-09 17:56 UTC

This package is auto-updated.

Last update: 2024-09-10 03:35:34 UTC


README

##关于 Simple RSS 生成器

您好,通过本页您可以生成简单的 RSS 2.0。

##工作示例

<?php
use Channaveer\RSS\RSS;

require_once './vendor/autoload.php';

$rssItems = [
    [
        'title'         => 'What Is Composer? How Does It Work? Useful Composer Commands And Usage',
        'url'           => 'https://somesite.in/posts/what-is-composer-how-does-it-work',
        'description'   => 'In this article, you will learn: What Is Composer, Using Composer, Installation In Ubuntu/Windows/Mac.',
        'updatedAt'     => '2020-05-07'
    ]
];

$path       = '.'; /** Path to generate your rss.xml file */
$filename   = 'rss.xml'; /** RSS filename default is rss.xml  */
$rss        = new RSS();

$rss->siteName('SiteName')
    ->siteUrl('https://siteurl.com')
    ->description('Some random description of the site')
    ->language('en-US') /** Default is en-Us you can set any of yours */
    ->lastUpdated($feedItems[0]['updatedAt']) /** Just pass datetime string or date string */
    ->generate($path, $rssItems, $filename);

RSS 项目是项目的数组,需要以下字段。

title
url
description
updatedAt