Skip to content

nikolaposa/disqus-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disqus Helper

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version PDS Skeleton

PHP library which facilitates integration of Disqus widgets.

Installation

The preferred method of installation is via Composer. Run the following command to install the latest version of a package and add it to your project's composer.json:

composer require nikolaposa/disqus-helper

Usage

Initialization

use DisqusHelper\Disqus;

$disqus = Disqus::create('disqus_shortname');

Template

<html>
    <head>
        <title>Blog</title>

        <?php
            //Page-specific Disqus configuration
            $disqus->configure([
                'page.identifier' => 'article1',
                'page.title' => 'My article',
            ]);
        ?>
    </head>

    <body>
        <article>
            <h1>My article</h1>
            <!-- Comments count widget -->
            <?php echo $disqus->commentsCount(['url' => 'http://example.com/article1.html']); ?>

            <p>My article text</p>
        </article>

        <div>
            <h2>Comments:</h2>
            <!-- Thread widget -->
            <?php echo $disqus->thread(); ?>
        </div>

        <!-- MUST be called at the end, usually before closing </body> tag -->
        <?php echo $disqus->getCode(); ?>
    </body>
</html>

See more examples.

Author

Nikola Poša

Copyright and license

Copyright 2017 Nikola Poša. Released under MIT License - see the LICENSE file for details.

About

💬 PHP library which facilitates integration of Disqus widgets.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages