# sfPropelPlanetPlugin
This plugin provides (very) simple feed aggregation features to your symfony 1.1
powered application.
[html]
<div style="border:solid 3px #ff8;padding:8px;background-color:#ffe;margin:5px 15%">
This plugin is <strong>not</strong> compatible with symfony 1.0
</div>
## Installation
The plugin and its dependecies can be installed using two methods, SVN or PEAR.
### SVN install
You must have an existing symfony project versionned in a subversion repository.
Edit the `svn:externals` property of the `plugins` directory of your symfony
project and add these lines if they don't exist yet:
sfFeed2Plugin http://svn.symfony-project.com/plugins/sfFeed2Plugin/
sfWebBrowser http://svn.symfony-project.com/plugins/sfWebBrowserPlugin/
sfPropelActAsSluggableBehaviorPlugin http://svn.symfony-project.com/plugins/sfPropelActAsSluggableBehaviorPlugin/
sfPropelPlanetPlugin http://svn.symfony-project.com/plugins/sfPropelPlanetPlugin/trunk
Now edit the `svn:externals` property of the `web` directory of your project and
type:
sfPropelPlanetPlugin http://svn.symfony-project.com/plugins/sfPropelPlanetPlugin/trunk/web
The later step is required if you want to have some styling using the web
modules.
Last but not least, run the `svn update` command from the root of your project.
## PEAR install
Run the following commands within a bash prompt at the root of your symfony project:
$ php symfony plugin-install -s beta sfPropelPlanetPlugin
Dependencies will be installed automatically.
## After plugin(s) has been installed
First, you must enable the Propel behaviors, tuning your `config/propel.ini`
file by changing the value of the `propel.builder.addBehaviors` property value:
propel.builder.addBehaviors = true
Then run the following commands within your project:
$ php symfony cache:clear
$ php symfony propel:build-all-load <appname>
Where `<appname>` is the name of one of your existing apps.
## Configuration
Planet configuration is mainly done in the `app.yml` file. A bundled `app.yml`
is provided to help yourself seeing what can be configured.
You can have an overview of what can be configured
[reading the bundled file](browser:plugins/sfPropelPlanetPlugin/trunk/config/app.yml).
## Usage
The plugin is bundled with two dedicated task and web modules.
Tasks can be used with from the command line interface, and you can schedule
them using the *nix [CRON](http://en.wikipedia.org/wiki/Cron) utility, eg.:
0 5 * * * php /path/to/your/symfony/project/symfony planet:grab-feed
This crontab entry will schedule outdated feeds fetching every morning at 5am.
Web modules provides quick'n'dirty frontend and backend rough web interfaces to
display and manage your data.
### Using the `planet:feed-add` task
The `planet:feed-add` allows you to add and grab a new feed to your planet. Here
is a sample call:
$ php symfony planet:feed-add http://feeds.feedburner.com/symfony/blog
Where the provided url is the feed url you want to add to your planet. This
command will fetch its entries, and store them in your database.
To get help on available options, just type:
$ php symfony help planet:feed-add
### Using the `planet:feed-grab` task
The `planet:grab-entries` updates outdated feed entries, I mean the ones which
the `periodicity` value has been exceeded.
To launch the task, just run the following command:
$ php symfony planet:feed-grab
To get help on available options, just type:
$ php symfony help planet:feed-grab
### Using bundled web modules
The web modules provides somewhat useful frontend and backend interfaces.
#### The `sfPlanetAdmin` web module
The `sfPlanetAdmin` module provides admin features of your feeds entries. From
there you can add, edit, delete and list available feeds in your planet. To
enable the module for an application, edit its `settings.yml` file as following:
all:
.settings
enabled_modules: [sfPlanetAdmin](default,)
Then eventually purge your application cache and browse to `/sfPlanetAdmin`.
#### The `sfPlanet` web module
The `sfPlanet` module provides list of feed entries as HTML or RSS output. To
enable the module for an application, edit its `settings.yml` file as following:
all:
.settings
enabled_modules: [sfPlanet](default,)
Then purge your application config cache with `php symfony cc` and browse to
`/planet/1.html` after having added some feeds to your planet.
Pagination is handled automatically, but configurable in the `app.yml` file.
Note that the plugin provided bundled symfony routes:
* `sf_planet_home`: The home of the planet, listing entries from all active
feeds
* `sf_planet_feed_home`: The list of all entries for a given feed, passing its
mandatory `slug` parameter
An RSS feed for the planet is also available. Just point your browser at
`/planet/1.rss` and enjoy. You can even paginate yout planet feed browsing
at `/planet/2.rss`, `/planet/3.rss` and so on.
By default, if you want to make a link pointing at the HTML home of your planet,
just use:
[php]
<?php echo link_to('my planet', '@sf_planet_home') ?>
If you want to make a link to a particular feed, just make a link using its
`slug` passed as a parameter:
[php]
<?php echo link_to('symfony blog entries', '@sf_planet_feed_home?slug=symfony-blog') ?>
The same goes for RSS feeds, just use the `sf_format` magic value, like this:
[php]
<?php echo link_to('my planet as an RSS feed', '@sf_planet_home?sf_format=rss') ?>
Last but not least, if you want to have your planet feed link added automagically
in the `<head/>` tag of your rendered HTML pages, you can use the bundled
`sfPlanetFeedLinkFilter` filter, adding this entry to the `filter.yml` file of
the app where you enabled the `sfPlanet` web module (yes, your frontend):
rendering: ~
security: ~
# insert your own filters here
planet:
class: sfPlanetFeedLinkFilter
cache: ~
common: ~
execution: ~
## License
This plugin is released under the terms of the
[MIT](http://en.wikipedia.org/wiki/MIT_License) license.
## Credits
This plugin has been released by Nicolas Perriault <nperriault -> gmail.com> and
makes deep use of these other nice plugins:
* [sfFeed2Plugin](sfFeed2Plugin)(/plugins/sfFeed2Plugin sfFeed2Plugin): handy feed utilities
* [sfWebBrowser](sfWebBrowser)(/plugins/sfWebBrowser sfWebBrowser): handy php web browsing utility
* [sfPropelActAsSluggableBehaviorPlugin](sfPropelActAsSluggableBehaviorPlugin)(/plugins/sfPropelActAsSluggableBehaviorPlugin sfPropelActAsSluggableBehaviorPlugin): handy slug generation utility
* [sfPagerNavigationPlugin](sfPagerNavigationPlugin)(/plugins/sfPagerNavigationPlugin sfPagerNavigationPlugin): pagination helper