Symfony plugin for Flattr

I just finished writing some documentation for my first Symfony plugin – sfFlattrPlugin! I encourage you to try it out and let me know what you think. Everything is up at GitHub, which means that you can easily share whatever improvements you conjure up.

This Symfony plugin enables easy to use integration with the Flattr service. Specifically, it provides a helper function to create Flattr buttons.


I recommend installing the plugin as a Git submodule:

$ git submodule add plugins/sfFlattrPlugin

Then you add it to your list of enabled plugins:

// config/ProjectConfiguration.class.php
class ProjectConfiguration extends sfProjectConfiguration
  public function setup()

And finally you add it you you filter chain:

# apps/frontend/config/filters.yml
rendering: ~
security:  ~
    class: sfFlattrFilter
cache:     ~
execution: ~


There are three ways to configure your Flattr buttons. You can either do it in app.yml, when you create buttons or a mix of the two.

These are the settings you can use in your app.yml:

    # Required
    uid:         User ID on Flattr.
    title:       The title of your item.
    description: A description of your item.
    category:    text, images, video, audio, software or rest
    # Optional
    language:    Language of the item, using syntax 'en_GB'.
    tags:        Comma seperated,list of,tags
    button:      normal (default) or compact
    hidden:      1 to hide, 0 (default) to show on listing
    html5:       false


Creating a Flattr buttons involves first including the helper. Either in your settings.yml:

# apps/frontend/config/settings.yml
      - Flattr

… or directly in your view:

<?php use_helper('Flattr') ?>

And then you may use the helper. Here is an example with most of the configuration options either instead of or to override settings in app.yml:

flattr_button(url_for('my_route', $item, true), array(
  'uid' => 'tobiassjosten',
  'title' => 'Example title',
  'description' => 'A very descriptive text',
  'category' => 'text',
  'button' => 'compact',
  'html5' => false,
  'data' => array('button' => 'compact'),

Simple as that!