PHP code example of hulsia / laravel-brevo-notifier
1. Go to this page and download the library: Download hulsia/laravel-brevo-notifier 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/ */
hulsia / laravel-brevo-notifier example snippets
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use YieldStudio\LaravelBrevoNotifier\BrevoEmailChannel;
use YieldStudio\LaravelBrevoNotifier\BrevoEmailMessage;
class OrderConfirmation extends Notification
{
public function via(): array
{
return [BrevoEmailChannel::class];
}
public function toBrevoEmail($notifiable): BrevoEmailMessage
{
return (new BrevoEmailMessage())
->templateId(1)
->to($notifiable->firstname, $notifiable->email)
->params(['order_ref' => 'N°0000001']);
}
}
namespace App\Notifications;
use Illuminate\Notifications\Notification
use YieldStudio\LaravelBrevoNotifier\BrevoSmsChannel;
use YieldStudio\LaravelBrevoNotifier\BrevoSmsMessage;
class OrderConfirmation extends Notification
{
public function via()
{
return [BrevoSmsChannel::class];
}
public function toBrevoSms($notifiable): BrevoSmsMessage
{
return (new BrevoSmsMessage())
->from('YIELD')
->to('+33626631711')
->content('Your order is confirmed.');
}
}