2017 © Pedro Peláez
 

yii2-extension yii2-rss

create rss uses by array or db query data

image

persianyii/yii2-rss

create rss uses by array or db query data

  • Monday, June 5, 2017
  • by seifzadeh
  • Repository
  • 1 Watchers
  • 1 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 5 % Grown

The README.md

create rss for yii2 framework

create rss uses by array or db query data, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist persianyii/yii2-rss "dev-master"

or add, (*4)

"persianyii/yii2-rss": "dev-master"

to the require section of your composer.json file., (*5)

Usage

Once the extension is installed, simply use it in your code by :, (*6)

```php $rss = new \persianyii\rss\Rss();, (*7)

    $items = [];
    $items['atomLinkHref'] = '';
    $items['title'] = 'My News';
    $items['link'] = 'http://mysite.com/news.php';
    $items['description'] = 'The latest news about web-development.';
    $items['language'] = 'en-us';
    $items['generator'] = 'PHP RSS Feed Generator';
    $items['managingEditor'] = 'editor@mysite.com (Alex Jefferson)';
    $items['webMaster'] = 'webmaster@mysite.com (Vagharshak Tozalakyan)';

    $posts = (new \yii\db\Query())->
    select(['title', 'content', 'create_time'])->
    from('tbl_post')->
    where(['status' => '1'])->
    limit(20)->
    all();

    $items['items'] = [];

    foreach ($posts as $k => $v) {
        $items['items'][] = [
            'title' => $v['title'],
            'description' => substr($v['content'], 0, 500),
            'link' => 'http://yii.com/post/show/' . $v['title'] . '.html',
            'pubDate' => date('Y/m/d H:i', $v['create_time']),
        ];
    }
    header('Content-Type: text/xml');
    echo $rss->createFeed($items);```

The Versions

05/06 2017

dev-master

9999999-dev

create rss uses by array or db query data

  Sources   Download

GPL-2.0

The Requires

 

by Avatar seifzadeh

extension yii2 rss