PHP code example of artox-lab / clarc-notification-bundle
1. Go to this page and download the library: Download artox-lab/clarc-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/ */
artox-lab / clarc-notification-bundle example snippets
// config/bundles.php
return [
// ...
ArtoxLab\Bundle\ClarcNotificationBundle\ArtoxLabClarcNotificationBundle::class => ['all' => true],
];
use App\Entities\Notification\ExampleNotification;
use ArtoxLab\Bundle\ClarcNotificationBundle\Notification\Entities\Notifier\NotifierInterface;
use ArtoxLab\Bundle\ClarcNotificationBundle\Notification\Entities\Recipient\EmailRecipient;
use ArtoxLab\Bundle\ClarcNotificationBundle\Notification\Entities\Recipient\SmsRecipient;
class Example
{
/**
* Notifier
*
* @var NotifierInterface
*/
private $notifier;
/**
* Example constructor.
*
* @param NotifierInterface $notifier Notifier
*/
public function __construct(NotifierInterface $notifier)
{
$this->notifier = $notifier;
}
/**
* Notify example
*
* @return void
*/
public function notify(): void
{
$notification = new ExampleNotification('test');
$smsRecipient = new SmsRecipient('+123123123');
$emailRecipient = new EmailRecipient('[email protected]');
$this->notifier->notify($notification, $smsRecipient, $emailRecipient);
}
}