PHP code example of w3lifer / yii2-disqus

1. Go to this page and download the library: Download w3lifer/yii2-disqus library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

w3lifer / yii2-disqus example snippets

 php
/**
 * @var $this \yii\web\View
 */

use w3lifer\yii2\Disqus;

// Widget

echo Disqus::widget([
    'shortName' => '<short name>', // Required
    'pageUrl' => '<page url>', // Optional
    'pageIdentifier' => '<page identifier>', // Optional
    'language' => '<language>', // Optional; default `Yii::$app->language`
    'callbacks' => [ // Optional; sinse 1.2.0
        'onReady' => 'function () { alert("onReady"); }', // String
        'onNewComment' => [ // Array
            'function () { alert("onNewComment 1"); }',
            'function () { alert("onNewComment 2"); }',
        ],
    ],
]);

// Number of comments (since 1.1.0)

Disqus::widget([
    'shortName' => '<short name>', // Required
    'onlyCountComments' => true,
]);