bhaktaraz/php-rss-generator
Composer 安装命令:
composer require bhaktaraz/php-rss-generator
包简介
Simple RSS generator library for PHP 5.5 or later.
README 文档
README
\Bhaktaraz\RSSGenerator is RSS generator library for PHP 5.5 or later.
Installation
You can install via Composer.
Add in your composer.json file:
{
"require": {
"bhaktaraz/php-rss-generator": "dev-master"
}
}
Run composer to install.
$ composer update
RSS Feed Implementation:
<?php $feed = new Feed(); $channel = new Channel(); $channel ->title("Programming") ->description("Programming with php") ->url('http://bhaktaraz.com.np/?cat=2') ->appendTo($feed); // RSS item $item = new Item(); $item ->title("CACHING DATA IN SYMFONY2") ->description("It is not too easy to enhance the performance of your application. In Symfony2 you could get benefit from caching.") ->url('http://bhaktaraz.com.np/?p=194') ->enclosure('http://bhaktaraz.com.np/wp-content/uploads/2014/08/bhakta-672x372.jpg', 4889, 'audio/mpeg') ->appendTo($channel); echo $feed;
Output:
<?xml version="1.0"?> <rss version="2.0"> <channel> <title>Programming</title> <link>http://bhaktaraz.com.np/?cat=2</link> <description>Programming with php</description> <item> <title>CACHING DATA IN SYMFONY2</title> <link>http://bhaktaraz.com.np/?p=194</link> <description>It is not too easy to enhance the performance of your application. In Symfony2 you could get benefit from caching.</description> <enclosure url="http://bhaktaraz.com.np/wp-content/uploads/2014/08/bhakta-672x372.jpg" type="audio/mpeg" length="4889"/> </item> </channel> </rss>
Facebook product feed implementation:
<?php $feed = new Feed(); $channel = new Channel(); $channel ->title("geekyrepo") ->description("geekyrepo - for geeks by a geek") ->url('https://geekyrepo.pasls.com') ->appendTo($feed); // Product feed item $item = new FacebookProductItem(); $item ->id(78) ->title("elePHPant Small") ->description("elePHPant hand made in nepal.") ->url('https://geekyrepo.pasls.com/product/elephpant-small') ->availability('in stock') ->condition('new') ->googleProductCategory('Apparel & Accessories > Clothing > Underwear & Socks') ->imageLink('https://geekyrepo.pasls.com/u/591415cc603dc_elephant-blue-small.jpg') ->brand('GeekyRepo') ->customLabel0('elephpant-small') ->customLabel1('ELESM') ->customLabel2('https://geekyrepo.pasls.com/product/elephpant-small') ->appendTo($channel); echo $feed;
Output:
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:g="http://base.google.com/ns/1.0" version="2.0"> <channel xmlns:g="http://base.google.com/ns/1.0"> <title>geekyrepo</title> <link>https://geekyrepo.pasls.com</link> <description>geekyrepo</description> <item xmlns:g="http://base.google.com/ns/1.0"> <g:id xmlns:g="http://base.google.com/ns/1.0">78</g:id> <g:title xmlns:g="http://base.google.com/ns/1.0">elePHPant Small</g:title> <g:link xmlns:g="http://base.google.com/ns/1.0"> https://geekyrepo.pasls.com/product/elephpant-small </g:link> <g:description xmlns:g="http://base.google.com/ns/1.0">elePHPant hand made in nepal.</g:description> <g:availability xmlns:g="http://base.google.com/ns/1.0">in stock</g:availability> <g:price xmlns:g="http://base.google.com/ns/1.0">699 NPR</g:price> <g:condition xmlns:g="http://base.google.com/ns/1.0">new</g:condition> <g:google_product_category xmlns:g="http://base.google.com/ns/1.0"> Apparel & Accessories > Clothing > Underwear & Socks </g:google_product_category> <g:image_link xmlns:g="http://base.google.com/ns/1.0"> https://geekyrepo.pasls.com/u/591415cc603dc_elephant-blue-small.jpg </g:image_link> <g:brand xmlns:g="http://base.google.com/ns/1.0">geekyrepo</g:brand> <g:custom_label_0 xmlns:g="http://base.google.com/ns/1.0">elephpant-small</g:custom_label_0> <g:custom_label_1 xmlns:g="http://base.google.com/ns/1.0"> https://geekyrepo.pasls.com/product/elephpant-small </g:custom_label_1> <g:custom_label_2 xmlns:g="http://base.google.com/ns/1.0">ELESM</g:custom_label_2> </item> </channel> </rss>
bhaktaraz/php-rss-generator 适用场景与选型建议
bhaktaraz/php-rss-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 126.53k 次下载、GitHub Stars 达 62, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「feed」 「rss」 「writer」 「Facebook product feed generator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bhaktaraz/php-rss-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bhaktaraz/php-rss-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bhaktaraz/php-rss-generator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Simple RSS generator library for PHP 5.5 or later. clone from Bhaktaraz Bhatta ttps://github.com/bhaktaraz/php-rss-generator
Import an RSS-feed into blog
Google Shopping Feed API (with ns problem fixed)
This module is designed to provide a special alerts feed block for Howard University
Phalcon Model Generator
统计信息
- 总下载量: 126.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 63
- 点击次数: 28
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知