Code Monkey home page Code Monkey logo

laravel-disqus's Introduction

laravel-disqus

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',
	 		)

laravel-disqus's People

Contributors

d-te avatar marcosbl avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.