PHP code example of betocampoy / champs-notification-center

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

    

betocampoy / champs-notification-center example snippets


use BetoCampoy\Champs\NotificationCenter\Repository\PdoNotificationRepository;
use BetoCampoy\Champs\NotificationCenter\Service\NotificationDispatcher;
use BetoCampoy\Champs\NotificationCenter\Service\NotificationReader;
use BetoCampoy\Champs\NotificationCenter\Service\NotificationActionHandler;

$repository = new PdoNotificationRepository($pdo);
$dispatcher = new NotificationDispatcher($repository);
$reader = new NotificationReader($repository);
$actions = new NotificationActionHandler($repository);

$dispatcher->dispatch(
    recipientType: 'user',
    recipientId: '1',
    subject: 'Boleto gerado',
    body: 'O boleto foi gerado com sucesso.',
    link: '/financeiro/boletos/123',
    type: 'finance'
);