phynix/notify

dev-master 2024-02-28 12:27 UTC

This package is not auto-updated.

Last update: 2024-09-25 15:04:32 UTC


README

通过电子邮件、短信或FCM发送通知

需要凭证,因此此包中不包含一些依赖项。请注意,这并不是一个完整的应用程序,而且很多其他包也被注入到其中。

发送电子邮件:需要

$to    = "david_chris@yahoo.com";
$subject = "Hello Testing Email Sender";
$message = "Testing Email Sender for application for the system we are sending for the library";
(new EmailService())->run($to, $subject, $message);

发送即时电子邮件:需要

$to    = "david_chris@yahoo.com";
$subject = "Hello Testing Email Sender";
$message = "Testing Email Sender for application for the system we are sending for the library";
(new EmailService())->runInstant($to, $subject, $message);

发送短信需要

$to    = "+447930152290";
$sms   = "Testing the new system for the applications Testing Email Sender for application for the system we are sending for the library Sender for application for the system we are sending for the library";
(new SmsService())->run($to, $sms);
(new SmsService())->runInstant($to, $sms);

发送FCM需要

$receiver    = "-CkWgJ8jsAxoM";
$message = "Testing Email Sender for application for the system we are sending for the library";
(new FcmService())->run($receiver, $message);

运行cron作业

Registering in Kernel:

Under Commands:

protected $commands = [
    'Notify\App\Command\SmsSender',
    'Notify\App\Command\EmailSender',
    'Notify\App\Command\FcmSender',
];

protected function schedule(Schedule $schedule)
{
    $schedule->command('notify:sms')->everyMinute();
    $schedule->command('notify:email')->everyMinute();
    $schedule->command('notify:fcm')->everyMinute();
}
.ENV keys:

PHYNIX_EMAIL_SENDER="Company Ltd<send@phynixmedia.co.uk>"
PHYNIX_EMAIL_API=https://fault/US-Ea
PHYNIX_SMS_API=https://wnj0nvhmyClo
PHYNIX_FCM_SENDER_ID=AAAA1Sr-UqPOjqB5gazX9I8b
PHYNIX_SEND_COUNTER=10
PHYNIX_SENDER_CODE=CompanyL

运行迁移


php artisan migrate --path=/vendor/phynix/notify/src/database/migrations/2022_06_23_140303_create_log_emails_table.php
php artisan migrate --path=/vendor/phynix/notify/src/database/migrations/2022_06_23_140433_create_log_fcm_table.php
php artisan migrate --path=/vendor/phynix/notify/src/database/migrations/2022_06_23_140433_create_log_sms_table.php