2017 © Pedro Peláez
 

symfony-bundle disqus-bundle

Provides a few Twig filters to integrate Symfony with Disqus

image

aureka/disqus-bundle

Provides a few Twig filters to integrate Symfony with Disqus

  • Tuesday, April 29, 2014
  • by carlescliment
  • Repository
  • 7 Watchers
  • 1 Stars
  • 71 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

AurekaDisqusBundle

Build Status, (*1)

Provides Twig funtions to facilitate the integration of your Symfony site with Disqus. It also enables the Disqus Single Sign-On., (*2)

Functions

  • disqus(blogpost): Append the JavaScript for the disqus thread.
  • disqus_count(): Appends the JavaScript for the comment count.

Installation

Add the following line to your composer.json:, (*3)

{
    "require": {
        "aureka/disqus-bundle" : "dev-master"
    }
}

Execute composer update., (*4)

Add the following line to your AppKernel.php., (*5)

public function registerBundles()
{
    $bundles = array(
        // your other bundles
        new Aureka\DisqusBundle\AurekaDisqusBundle(),
    );
}

Configuration

Add the following lines to your config.yml:, (*6)

aureka_disqus:
    short_name: 'your_shortname' # used to identify the site in disqus

Basic usage

Make the class an implementation of the interface Disqusable:, (*7)

# src/Acme/DemoBundle/Entity/BlogPost.php

namespace Acme\DemoBundle\Entity;

use Aureka\DisqusBundle\Model\Disqusable;

class BlogPost implements Disqusable
{

    // ... your other methods

    public function getDisqusId()
    {
        return $this->disqusId; // generate it on the fly or make it persisted.
    }
}

Use the twig filter in your template., (*8)

{# src/Acme/DemoBundle/Resources/views/BlogPost/show.html.twig #}

{# renders the thread and comment form #}
{{ disqus(blogpost) }}

{# adds the count for any disqus link #}
{{ disqus_count() }}

Single Sign-On

Disqus brings a Single Sign-On feature that lets your application authenticate its users in Disqus., (*9)

In order to do that you need to activate the add-on in your Disqus account, create an app for your website and add the following settings to config.yml:, (*10)

aureka_disqus:
    short_name: 'your_shortname' # used to identify the site in disqus
    sso:
        enabled: true
        api_key: 'enter_your_api_key_here'
        private_key: 'enter_the application_private_key_here'

Now go to your User class and make it an implementation of DisqusUser:, (*11)

# src/Acme/DemoBundle/Entity/User.php

namespace Acme\DemoBundle\Entity;

use Areka\DisqusBundle\Model\DisqusUser;

class User implements DisqusUser
{
    public function getDisqusId()
    {
        return $this->id; // Or a custom generated id
    }
}

For further information, please visit the official documentation., (*12)

The Versions

29/04 2014

dev-master

9999999-dev

Provides a few Twig filters to integrate Symfony with Disqus

  Sources   Download

Apache2

The Requires

 

The Development Requires

29/04 2014

0.0.2

0.0.2.0

Provides a few Twig filters to integrate Symfony with Disqus

  Sources   Download

Apache2

The Requires

 

The Development Requires

24/04 2014

0.0.1

0.0.1.0

Provides a few Twig filters to integrate Symfony with Disqus

  Sources   Download

Apache2

The Requires

 

The Development Requires