PHP code example of grossum / notification-bundle

1. Go to this page and download the library: Download grossum/notification-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/ */

    

grossum / notification-bundle example snippets


    // app/AppKernel.php
    
    public function registerBundles()
    {
        $bundles = array(
            new GrossumUA\NotificationBundle\NotificationBundle(),
            new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
        );
    }


    $userNotification = new MessageNotification();
    
    $userNotification
        ->setType(NotificationInterface::SOCKET_NOTIFICATION_TYPE_WEB_NOTIFICATION)
        ->setContent('You have created task to demo NotificationBundle')
        ->setMediaUrl('https://pbs.twimg.com/profile_images/564783819580903424/2aQazOP3.png')
        ->setTitle('You have created task to demo NotificationBundle')
        ->setCreatedAt(new \DateTime())
        ->setRecipientHashes(['sds12']);

    $this->disptacher->dispatch(
        'grossum.notification.event.send_notification',
        new NotificationCreatedEvent($userNotification)
    );