imelgrat/opml-parser

OPML 解析类:从 OPML 文件中提取内容属性。

2.2.0 2018-08-27 15:05 UTC

This package is not auto-updated.

Last update: 2024-09-13 11:57:42 UTC


README

GitHub license GitHub release Total Downloads GitHub issues GitHub stars

OPML 解析类:从 OPML 文件中提取内容属性。

扩展名为 OPML 的文件是轮廓处理器标记语言文件。它使用 XML 格式保存,用于在操作系统无关的应用程序之间交换信息。

OPML 文件格式通常用作 RSS 阅读器程序的导入/导出格式。由于这种格式的文件可以存储 RSS 订阅信息集合,因此它是备份或共享 RSS 流的理想格式。该类检索本地或远程 OPML 文件并将其解析为 PHP 迭代器。迭代器中的每个元素都包含所列内容的 URL 以及每个内容条目的所有其他属性,例如:名称、链接目标、描述、RSS 流、创建日期和内容类型(RSS、HTML、歌曲、书单等)。

Ivan Melgrati 开发

要求

  • PHP >= 5.3.0

安装

Composer

推荐安装方法是使用 Composer,PHP 的依赖关系管理器。只需将 imelgrat/opml-parser 添加到您的项目 composer.json 文件中

{
    "require": {
        "imelgrat/opml-parser": "*"
    }
}

[More details](https://packagist.org.cn/packages/imelgrat/opml-parser) can
be found over at [Packagist](https://packagist.org.cn).

### Manually

1.  Copy `src/opml-parser.php` to your codebase, perhaps to the `vendor`
    directory.
2.  Add the `OPML_Parser` class to your autoloader or `require` the file
    directly.

Then, in order to use the OPML class, you need to invoke the "use" operator to bring the class into skope.

```php
<?php
use imelgrat\OPML_Parser\OPML_Parser;

$parser = new OPML_Parser();

// Get OPML from URL
$parser->ParseLocation('http://www.bbc.co.uk/podcasts.opml', null);

// Walk through each item in the same way as we would if $parser were a string (thanks to the Iterator interface)
foreach ($parser as $key => $item)
{
	echo "<p> Item: " . $key . '</p><ul>';
	foreach ($item as $attribute => $value)
	{
		echo '<li>' . '<strong>' . $attribute . '</strong>:' . $value . '</li>';
	}
	echo '</ul>';
	echo '<p>&nbsp;</p>';

}
?>

反馈

请打开一个问题以请求功能或提交错误报告。或者,如果您只想提供一些反馈,我也很乐意倾听。您也可以在 Twitter 上关注我 @imelgrat

贡献

  1. 分支它。
  2. 创建您的功能分支(git checkout -b my-new-feature)。
  3. 提交您的更改(git commit -am '添加了一些功能')。
  4. 推送到分支(git push origin my-new-feature)。
  5. 创建新的拉取请求。