Notification channel for sms of operator A1 (velcome)
a-mazalov/a1-notification-channel is a Laravel package for notification channel for sms of operator a1 (velcome).
It currently has 1 GitHub stars and 142 downloads on Packagist (latest version v1.0.3).
Install it with composer require a-mazalov/a1-notification-channel.
Discover more Laravel packages by a-mazalov
or browse all Laravel packages to compare alternatives.
Last updated
Пакет добавляет возможность отправки СМС уведомлений через оператора А1 (Velcome)
Установка через composer:
composer require a-mazalov/a1-notification-channel
Далее необходимо указать данные доступа.
php artisan vendor:publish --provider="A1\Channel\A1ServiceProvider" --tag="config"
// config/a1.php
return [
"api_key" => env('A1_API_KEY', null),
"api_login" => env('A1_API_LOGIN', null),
"api_scheme" => env('A1_API_SCHEME', 'http'),
"api_endpoint" => env('A1_API_ENDPOINT', 'http://smart-sender.a1.by/api/'),
];
A1_API_KEY=
A1_API_LOGIN=
A1_API_SCHEME=http
A1_API_ENDPOINT=http://smart-sender.a1.by/api/
// bootstrap/app.php
$app->register(A1\Channel\A1ServiceProvider::class);
// Опционально регистрация фасада
$app->withFacades(true, [
// ...
'A1\Channel\A1Facade' => 'A1Client',
]);
namespace App\Notifications;
use A1\Channel\A1Message;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class TestNotification extends Notification
{
use Queueable;
public $message;
public function __construct($message)
{
$this->message = $message;
}
public function via($notifiable)
{
return ['a1'];
}
// ..
public function toA1($notifiable)
{
return (new A1Message)
->content($this->message);
}
}
// App\Models\v1\Employee
// Так же необходимо добавить трейт для уведомлений
use Notifiable;
public function routeNotificationForA1()
{
return $this->mtel ? '375' . $this->mtel : null;
}
$user->notify(new Notification())
// A1\Channel\A1Client;
A1Client::sendSms('375290001122', 'Текст сообщения');
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.