PHP code example of abdogoda / laravel-notification-system
1. Go to this page and download the library: Download abdogoda/laravel-notification-system 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/ */
abdogoda / laravel-notification-system example snippets
use NotificationSystem\Facades\NotificationSystem;
NotificationSystem::make()
->title('Welcome to the Platform!')
->body('Thank you for joining our academy.')
->channels(['database', 'mail', 'fcm'])
->to($user)
->locale('ar')
->data([
'action_url' => '/dashboard',
'type' => 'welcome_onboarding'
])
->send();
NotificationSystem::make()
->title('Scheduled Maintenance Alert')
->body('The system will undergo scheduled maintenance tonight at 12:00 AM.')
->channels(['database', 'fcm'])
->to(['students', 'teachers', 'merchants'])
->send();
'table_name' => 'notification_logs',
'logging_enabled' => true,
'log_retention_days' => 90, // Set to null to keep forever
use NotificationSystem\Contracts\ChannelInterface;
use NotificationSystem\DTOs\NotificationData;
use NotificationSystem\DTOs\RecipientData;
class SlackChannel implements ChannelInterface
{
public function send(RecipientData $recipient, NotificationData $notification): array|bool
{
// Your Slack sending logic here
return ['status' => 'sent'];
}
}
use NotificationSystem\Facades\NotificationSystem;
NotificationSystem::extend('slack', SlackChannel::class);