承接 utlime/php-rss-writer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

utlime/php-rss-writer

Composer 安装命令:

composer require utlime/php-rss-writer

包简介

Optimized RSS writer

README 文档

README

Optimized RSS writer, which based on Iterator interface. This allow to implement Lazy Load pattern.

Specification

https://validator.w3.org/feed/docs/rss2.html

Installation

You can install directly via Composer:

$ composer require "utlime/php-rss-writer":"^1.0"

Example

examples/example.php

<?php

require "../vendor/autoload.php";

$item_iterator = function ($prefix) {
    for ($i = 0; $i < 3; $i++) {
        $item = new \Utlime\RSS\Item();

        $item->setTitle($prefix . ' title' . $i);

        yield $item;
    }
};

$channel_iterator = function () use ($item_iterator) {
    for ($i = 0; $i < 2; $i++) {
        $channel = new \Utlime\RSS\Channel('title' . $i, 'link' . $i, 'description' . $i);

        $channel->setItems($item_iterator('channel' . $i));

        yield $channel;
    }
};

$output = function ($string) {
    echo $string . "\r\n";
};

$rss = new \Utlime\RSS\RSS();
$rss->setChannels($channel_iterator());

$writer = new Utlime\RSS\Writer($output);
$writer->write($rss);

Feed format

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
    <channel>
        <title></title>
        <link></link>
        <description></description>
        <language></language>
        <copyright></copyright>
        <pubDate></pubDate>
        <lastBuildDate></lastBuildDate>
        <category></category>
        <ttl></ttl>
        <item>
            <title></title>
            <link></link>
            <description></description>
            <category></category>
            <guid></guid>
            <pubDate></pubDate>
            <enclosure></enclosure>
        </item>
    </channel>
</rss>

How to test

$ composer install --dev
$ vendor/bin/phpunit

License

MIT license

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固