marcw / rss-writer
A simple yet powerful RSS2 feed writer with RSS extensions support (like iTunes podcast tags)
Installs: 31 746
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 2
Forks: 6
Open Issues: 0
Requires
- ext-xmlwriter: *
Requires (Dev)
- phpunit/phpunit: ^5.4
- symfony/debug: ^3.1
- symfony/http-foundation: ^3.1
- symfony/validator: ^3.1
- symfony/var-dumper: ^3.1
Suggests
- symfony/http-foundation: Enable streaming RSS response
- symfony/validator
This package is not auto-updated.
Last update: 2024-12-20 23:47:06 UTC
README
A simple, yet powerful and fully customizable RSS 2.0 writing library, with a native support of iTunes podcasting tags and other RSS extensions.
Why a new Rss writing library?
At the time of writing this library, the current state of feed writing libraries was not satisfying. What I found was either difficult to extend, too generic, or wasn't taking advantage of best practices in order to reduce the Time To First Byte.
Why should I use this over other libraries?
Use this library if you want:
- RSS2 feeds (because there's no support for other types of feed).
- Extensions for iTunes podcasting, Slash, Sy, DublinCreator, Atom, or just your own.
- Best performance (memory and TTFB) thanks to XML Streaming.
- Object oriented feed creation with POPO
How can I install it?
Run composer require marcw/rss-writer
.
How does it work?
Feed creation
See this file.
Rss Streamed Response
See this file.
Symfony Bridge
HttpFoundation
The library provides an extension to the Symfony\Component\HttpFoundation\Response
class for streaming rss responses to the client. See RssStreamedResponse.php
.
Use it from your controllers like this:
use MarcW\RssWriter\Bridge\Symfony\HttpFoundation\RssStreamedResponse; public function myAction() { // $channel = ... (whatever you use to create your Channel object) return new RssStreamedResponse($channel, $this->get('marcw_rss_writer.rss_writer')); }
Form
An iTunes category choice list is available to use in your forms. Follow this example:
<?php namespace AppBundle\Form; use MarcW\RssWriter\Bridge\Symfony\Form\ChoiceList\Loader\ItunesCategoryChoiceLoader; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; class MyFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { // ... $builder->add('category', ChoiceType::class, ['choice_loader' => new ItunesCategoryChoiceLoader()]) // ... } }
Symfony Bundle
This library also provides a Symfony bundle.
Add this to your AppKernel.php
file.
new MarcW\RssWriter\Bundle\MarcWRssWriterBundle()
You can now use the marcw_rss_writer.rss_writer
service.
Can I contribute?
Sure! Feel free to report issues, send pull-requests, or ask for help.
Projects using this lib
- Banditore retrieves new releases from your Github starred repositories and put them in a RSS feed.
LICENSE
See the LICENSE file.