PHPackages                             shuguang/yii2-rss - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. shuguang/yii2-rss

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

shuguang/yii2-rss
=================

Yii2 Framework extension to provide functionality for consuming RSS and Atom feeds using zend-feed library.

0181PHP

Since Dec 5Pushed 9y ago1 watchersCompare

[ Source](https://github.com/shuguang/yii2-rss)[ Packagist](https://packagist.org/packages/shuguang/yii2-rss)[ RSS](/packages/shuguang-yii2-rss/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-rss
========

[](#yii2-rss)

Yii2 Framework extension to provide functionality for consuming RSS and Atom feeds using zend-feed library.

Installation
------------

[](#installation)

```
php composer.phar require "shuguang/yii2-rss:dev-master"

```

or

```
{
	"require":
	{
  		"shuguang/yii2-rss": "dev-master"
	}
}

```

Configuration
-------------

[](#configuration)

In config file

```
/config/web.php

```

Add feed component

```
'components' => array(
	...
	'feed' => array(
		'class' => 'yii\feed\FeedDriver',
	),
)

```

Simple usage
------------

[](#simple-usage)

**Read Rss feed:**

```
$feed=Yii::$app->feed->reader()->import('http://exapmple.com/feed.rss');
```

This will get RSS feed, parse it and return feed object. For more details you can read the official Zend-feed extention documentaion:

**Create Rss feed:**

Create action Rss in controller

```
public function actionRss(){

    $feed=Yii::$app->feed->writer();
    $feed->setTitle(Yii::$app->params['title']);
	$feed->setLink('http://example.com');
	$feed->setFeedLink('http://example.com/rss', 'rss');
	$feed->setDescription(Yii::t('app','Recent headlines'));
	$feed->setGenerator('http://example.com/rss');
	$feed->setDateModified(time());
	/**
	* Add one or more entries. Note that entries must
	* be manually added once created.
	*/
	$posts=Post::find()->orderBy('id DESC')->limit(20)->all();
	foreach($posts as $post){
			$entry = $feed->createEntry();
			$entry->setTitle($post->title);
			$entry->setLink(Yii::$app->urlManager->createAbsoluteUrl('/post/view',['id'=>$post->id]));
			$entry->setDateModified(intval($post->created));
			$entry->setDateCreated(intval($post->created));
			$entry->setContent(
			   $post->content
			);
			$entry->setEnclosure(
				[
				 'uri'=>$post->image,
				 'type'=>'image/jpeg',
				 'length'=>filesize(Yii::getAlias('@webroot').$post->image)
				 ]
			);
			$feed->addEntry($entry);
	}
	/**
	* Render the resulting feed to Atom 1.0 and assign to $out.
	* You can substitute "atom" with "rss" to generate an RSS 2.0 feed.
	*/
	$out = $feed->export('rss');
	header('Content-type: text/xml');
	echo $out;
	die();
}
```

Then it's better to cache it with cache component:

```
public function behaviors() {
	return [
		....
		'cache'=> [
			'only'=>['rss'],
			'class'=>PageCache::className(),
			'duration'=>0,
			'dependency'=>[
				'class' => 'yii\caching\DbDependency',
				'sql' => 'SELECT max(time_updated) as max FROM tbl_post',
			],
		]
	];
}
```

Take a look at Zend-feed writer official documentaion for more advanced usage of Zend-feed

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/75050d47701d842a46df865b9077dfe498c6a293f582db71b9a8af53873009c2?d=identicon)[shuguang](/maintainers/shuguang)

---

Top Contributors

[![shuguang](https://avatars.githubusercontent.com/u/1232375?v=4)](https://github.com/shuguang "shuguang (1 commits)")

### Embed Badge

![Health badge](/badges/shuguang-yii2-rss/health.svg)

```
[![Health](https://phpackages.com/badges/shuguang-yii2-rss/health.svg)](https://phpackages.com/packages/shuguang-yii2-rss)
```

###  Alternatives

[openlss/lib-array2xml

Array2XML conversion library credit to lalit.org

31053.4M49](/packages/openlss-lib-array2xml)[enqueue/dsn

Parse DSN

12526.3M57](/packages/enqueue-dsn)[matthiasnoback/php-ast-inspector

70212.6k](/packages/matthiasnoback-php-ast-inspector)[webdevstudios/oops-wp

A collection of interfaces and class structures to promote object-oriented programming practices in WordPress.

5821.2k1](/packages/webdevstudios-oops-wp)[coreproc/nova-auditing-user-fields

A Laravel Nova field that works with the Laravel Auditing package to see who created or last updated a resource.

10111.6k](/packages/coreproc-nova-auditing-user-fields)[akiraz2/yii2-ticket-support

Yii2 Support Ticket Module, easy, flexible, fast

601.7k](/packages/akiraz2-yii2-ticket-support)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
