2017 © Pedro Peláez
 

library rss

image

knj/rss

  • Monday, October 30, 2017
  • by KNJ
  • Repository
  • 1 Watchers
  • 0 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

RSS

StyleCI, (*1)

Example

<?php
namespace Wazly\Feed;

header('Content-Type: text/xml; charset=UTF-8');

require_once __DIR__ . '/../vendor/autoload.php';

use DateTime;

$now = new DateTime;

$rss = new Rss([
    'xmlns:content' => 'http://purl.org/rss/1.0/modules/content/',
    'xmlns:gnf' => 'http://assets.gunosy.com/media/gnf',
    'xmlns:media' => 'http://search.yahoo.com/mrss/',
    'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
]);

$rss->addTextElement('title', 'Wazly', true)
    ->addTextElement('link', 'https://example.wazly.net')
    ->addTextElement(
        'description',
        'Site description here.',
        true
    )
    ->addTextElement(
        'lastBuildDate',
        $now->format(DateTime::RFC2822)
    )
    ->addTextElement('language', 'ja')
    ->addElement('image', function ($elem) {
        $url = Creator::createElement('url')->addText('https://example.wazly.net/img/logo.png');
        $title = Creator::createElement('title')->addText('Wazly')->cdata();
        $link = Creator::createElement('link')->addText('https://example.wazly.net');
        $elem->push($url, $title, $link);

        return $elem;
    });

$item = new Item;
$item->addTextElement('title', 'How to Build Your Application on CircleCI 2.0', true)
    ->addTextElement('link', 'https://example.wazly.net/article/1234')
    ->addTextElement('guid', 'https://example.wazly.net/article/1234')
    ->addTextElement('description', 'CircleCI 2.0 gives your team more speed and configurability than ever before...', true)
    ->addTextElement('pubDate', $now->format(DateTime::RFC2822))
    ->addTextElement('content:encoded', 'Flexible, automated provisioning allows teams to take full advantage of parallel execution for less downtime waiting for a workflow to complete...', true)
    ->addTextElement('gnf:category', 'technology')
    ->addFlatElement('enclosure', [
        'url' => 'https://example.wazly.net/img/article/915fb.jpg',
        'type' => 'image/jpeg',
        'length' => '626124',
    ])
    ->addFlatElement('gnf:relatedLink', [
        'title' => 'How to Build, Test and Deploy Your Project with AWS CodePipeline',
        'link' => 'https://example.wazly.net/article/660?utm_source=unko&utm_medium=banner',
    ])
    ->addFlatElement('gnf:relatedLink', [
        'title' => 'CircleCI 2.0 is Now Released',
        'link' => 'https://example.wazly.net/article/1001?utm_source=unko&utm_medium=banner',
    ])
    ->addElement('rel', function ($elem) {
        $rel_title = Creator::createElement('rel_title')->addText('Introduction to Continuous Integration')->cdata();
        $rel_link = Creator::createElement('rel_link')->addText('https://example.wazly.net/article/563?utm_source=unko&utm_medium=banner')->cdata();
        $rel_creator = Creator::createElement('rel_creator')->addText('knj')->cdata();

        return $elem->push($rel_title, $rel_link, $rel_creator);
    });

$rss->add($item->dump());

echo $rss->publish();

The Versions

30/10 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Avatar KNJ

30/10 2017

0.4.0

0.4.0.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Avatar KNJ

09/09 2017

0.3.0

0.3.0.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Avatar KNJ

09/09 2017

dev-dev

dev-dev

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Avatar KNJ

09/09 2017

0.2.0

0.2.0.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Avatar KNJ

11/08 2017

0.1.1

0.1.1.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Avatar KNJ

06/07 2017

0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Avatar KNJ