Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ancoka/atom-feed
A simple atom feed builder for PHP
https://github.com/ancoka/atom-feed
atom-feed composer php rss rss-generator
Last synced: 2 months ago
JSON representation
A simple atom feed builder for PHP
- Host: GitHub
- URL: https://github.com/ancoka/atom-feed
- Owner: ancoka
- License: mit
- Created: 2016-04-30T03:37:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-22T02:03:13.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T02:45:38.984Z (9 months ago)
- Topics: atom-feed, composer, php, rss, rss-generator
- Language: PHP
- Size: 18.6 KB
- Stars: 2
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# atom-feed
atom-feed是一个采用Atom协议的用于生成网站聚合应用信息的一个简单的PHP程序。##安装
环境要求:PHP >= 5.4
直接使用composer命令安装:```
composer require "ancoka/atom-feed:~1.0"
```
或者添加如下代码到composer.json文件中:```
{
"require": {
"ancoka/atom-feed" : "~1.0"
}
}
```
然后运行composer来安装它```
composer install
```
使用前引入 "vendor/autoload.php" 文件:```
require_once 'vendor/autoload.php';
```
##使用```
title('title')
->subtitle('subtitle')
->id('http://www.example.com')
->updated(time())
->link(['href' => 'http://www.example.com'])
->link(['href' => 'http://www.example.com/atom.xml', 'rel' => 'self'])
->rights('© 2005 Example, Inc.')
->appendTo($atom);$entry = new Entry();
$entry->id('http://www.example.com/article/1')
->title('article title 1')
->subtitle('article subtitle 1')
->summary('article summary 1')
->content('article content 1')
->category(['term' => 'category1', 'scheme' => 'http://www.ucoolife.com/category/category1'])
->author(['name' => 'kevin', 'email' => '[email protected]', 'uri' => 'http://example.com/~kevin'])
->appendTo($feed);$entry = new Entry();
$entry->id('http://www.example.com/article/2')
->title('article title 2')
->subtitle('article subtitle 2')
->summary('article summary 2')
->content('article content 2')
->category(['term' => 'category2', 'scheme' => 'http://www.ucoolife.com/category/category2'])
->author(['name' => 'kevin', 'email' => '[email protected]', 'uri' => 'http://example.com/~kevin'])
->appendTo($feed);header('Content-type:application/atom+xml; charset=utf-8');
echo $atom;
```
上面代码涵盖常用用法,更多请查看接口文件源码:[AtomInterface](https://github.com/ancoka/atom-feed/blob/master/src/XMLBuilder/AtomInterface.php)、[FeedInterface](https://github.com/ancoka/atom-feed/blob/master/src/XMLBuilder/FeedInterface.php)和[EntryInterface](https://github.com/ancoka/atom-feed/blob/master/src/XMLBuilder/EntryInterface.php)##参考
* [About atom feed](https://tools.ietf.org/html/rfc4287)
##License
MIT