d-te/laravel-disqus
Composer 安装命令:
composer require d-te/laravel-disqus
包简介
Disqus integration for Laravel
关键字:
README 文档
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:
- 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,
- 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', )
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-12