PHP code example of heimrichhannot / contao-social-stats-bundle

1. Go to this page and download the library: Download heimrichhannot/contao-social-stats-bundle 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/ */

    

heimrichhannot / contao-social-stats-bundle example snippets


use HeimrichHannot\SocialStatsBundle\Event\AddNewsArticleUrlsEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class SocialStatsEventSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return [
            AddNewsArticleUrlsEvent::class => 'addNewsArticleUrls',
        ];
    }

    public function addNewsArticleUrls(AddNewsArticleUrlsEvent $event)
    {
        $event->addUrl($event->getBaseUrl().'/my_custom_news_article_route/'.$event->getItem()->id);
    }
}