d-te/laravel-disqus

Disqus integration for Laravel

dev-master 2015-01-15 11:29 UTC

This package is not auto-updated.

Last update: 2024-05-11 14:28:39 UTC


README

Disqus comments for laravel 4

Installation

Add the package in your composer.json file and run composer update.

{
    "require": {
        "d-te/laravel-discus": "dev-master"
    }
}

Registering the Package

Register the service provider within the providers array found in app/config/app.php:

'providers' => array(
	// ...
	
	'Dte\Disqus\DisqusServiceProvider'
)

Add an alias within the aliases array found in app/config/app.php:

'aliases' => array(
	// ...
	
	'Disqus' => 'Dte\Disqus\Facades\Disqus',
)

Configuration

Create configuration file for package using artisan command

$ php artisan config:publish d-te/laravel-disqus

Usage

Basic usage

Add 'disqus_shortname' to app/config/packages/d-te/laravel-disqus/config.php.

You can find your disqus shortname afer signing up and visiting https://disqus.com/admin/settings/

In your template add :

  {{ \Disqus::comments() }}

Additional disqus configuration variables

There are some disqus configuration variables:

  • disqus_identifier
  • disqus_title
  • disqus_url
  • disqus_category_id

Example of usage:

 {{ \Disqus::comments(
     array(
       'disqus_identifier' => '/december-2010/the-best-day-of-my-life/',
       'disqus_title' => 'Some title',
       'disqus_url' => 'http://example.com/helloworld.html',
       'disqus_category_id' => 123456
   ) ) }}

Multi-lingual support

There are two ways how to change disqus locales:

  1. To switch on auto selecting disqus language based on Laravel app locale:

in app/config/packages/d-te/laravel-disqus/config.php set

  'auto_set_language' => true,
  1. Set locale manually in template:
  {{ \Disqus::comments(array('language' => 'de')) }}

Sometimes discus locale could not corresponde to your app locale. To convert your app locale to discus locale just add supported locales to config app/config/packages/d-te/laravel-disqus/config.php example:

	  'discus_languages' => array(
	 			'ua' => 'uk',
	 			'fr' => 'fr_CA',
	 		)