PHP code example of sogabundle / notificaciones-vanadio

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

    

sogabundle / notificaciones-vanadio example snippets


class MyController extends Controller
{

    ...

    public function sendNotification(Request $request)
    {
       $manager = $this->get('mgilet.notification');
      $notif = $manager->createNotification('Hello world !');
      $notif->setMessage('This a notification.');
      $notif->setLink('http://symfony.com/');
      // or the one-line method :
      // $manager->createNotification('Notification subject','Some random text','http://google.fr');

      // you can add a notification to a list of entities
      // the third parameter `$flush` allows you to directly flush the entities
      $manager->addNotification(array($this->getUser()), $notif, true);
      
      ...
    }