https://github.com/funstaff/funstafffeedbundle
Feed Generator for Symfony2
https://github.com/funstaff/funstafffeedbundle
Last synced: 12 months ago
JSON representation
Feed Generator for Symfony2
- Host: GitHub
- URL: https://github.com/funstaff/funstafffeedbundle
- Owner: Funstaff
- License: mit
- Created: 2011-11-17T18:56:40.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-12-16T20:12:29.000Z (over 14 years ago)
- Last Synced: 2025-02-22T21:27:58.724Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 113 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
FunstaffFeedBundle
==================
Under development
Configuration
-------------
funstaff_feed:
channels:
FeedTitle:
title: 'Feed title'
description: 'Feed Description'
link: 'http://feed/url'
language: ~
copyright: ~
managingEditor: ~
webMaster: ~
pubDate: ~
lastBuildDate: ~
category: [cat1, cat2, cat3]
docs: ~
cloud: [
domain: "rpc.sys.com"
port: "80"
path: "/RPC2"
registerProcedure: "pingMe"
protocol="soap"
]
ttl: ~
rating: ~
image: ~
rating: ~
textInput: ~
skipHours: ~
skipDays: ~
encoding: ~ (default: UTF-8)
The fields title, description and link are mandatory
Use
---
Implement FeedItemInterface on your entity and add 3 mandatories methods:
- getFeedTitle
- getFeedLink
- getFeedDescription
use Funstaff\FeedBundle\Feed\FeedItemInterface;
class New implements FeedItemInterface
{
...
function getFeedTitle()
{
return $this->title;
}
function getFeedLink()
{
return array('id' => $this->id);
}
function getFeedDescription()
{
return $this->abstract;
}
}
Another fields are optionals.
In your controller:
$results = $this->get('doctrine')
->getRepository('FooBarBundle:Foo')
->findAll();
$feed = $this->get('funstaff_feed.factory')
->createFeed('FeedTitle', '201')
->addItems($results, 'FooShow')
->render();
$response = new Response($feed);
$response->headers->set('Content-Type', 'text/xml');