mekras/atom
最新稳定版本:v1.0.0
Composer 安装命令:
composer require mekras/atom
包简介
Atom Protocol support library
README 文档
README
Purpose
This library is designed to work with the Atom documents in an object-oriented style. It does not contain the functionality to download or display documents.
Documentation
Example
use Mekras\Atom\Document\FeedDocument; use Mekras\Atom\DocumentFactory; use Mekras\Atom\Exception\AtomException; $xml = file_get_contents('http://example.com/atom'); $factory = new DocumentFactory(); try { $document = $factory->parseXML($xml); } catch (AtomException $e) { die($e->getMessage()); } if ($document instanceof FeedDocument) { $feed = $document->getFeed(); echo 'Feed: ', $feed->getTitle(), PHP_EOL; echo 'Updated: ', $feed->getUpdated()->format('d.m.Y H:i:s'), PHP_EOL; foreach ($feed->getAuthors() as $author) { echo 'Author: ', $author->getName(), PHP_EOL; } foreach ($feed->getEntries() as $entry) { echo PHP_EOL; echo ' Entry: ', $entry->getTitle(), PHP_EOL; if ($entry->getSelfLink()) { echo ' URL: ', $entry->getSelfLink(), PHP_EOL; } else { echo PHP_EOL, (string) $entry->getContent(), PHP_EOL; } } }
统计信息
- 总下载量: 10.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-01