nikolaposa / disqus-helper
PHP library which facilitates integration of Disqus widgets.
Installs: 30 463
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ~7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^1.11
- phpunit/phpunit: ^5.0
README
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.