This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
You can install the package via composer:
composer require apxcde/laravel-onfon-sms
You can publish the config file with:
php artisan vendor:publish --provider="Apxcde\OnfonSms\OnfonSmsServiceProvider" --tag="onfon-sms-config"
This is the contents of the published config file:
return [
'senderId' => env('ONFON_SMS_SENDER_ID', ''),
'api_key' => env('ONFON_SMS_API_KEY', ''),
'client_id' => env('ONFON_SMS_CLIENT_ID', ''),
'access_key' => env('ONFON_SMS_ACCESS_KEY', ''),
];
Set the variables below in your .env file. You will receive these variables from onfon media
ONFON_SMS_SENDER_ID=""
ONFON_SMS_API_KEY=""
ONFON_SMS_CLIENT_ID=""
ONFON_SMS_ACCESS_KEY=""
Add the routeNotificationForOnfon method on your notifiable Model. If this is not added, the phone_number field will be automatically used.
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* Route notifications for the OnFon channel.
*
* @param \Illuminate\Notifications\Notification $notification
* @return string
*/
public function routeNotificationForOnfon($notification)
{
return $this->phone;
}
}
To use this package, you need to create a notification class, like NewsWasPublished from the example below, in your Laravel application. Make sure to check out Laravel's documentation for this process.
<?php
use Apxcde\OnfonSms\OnfonChannel;
use Apxcde\OnfonSms\OnfonMessage;
class NewsWasPublished extends Notification
{
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [OnfonChannel::class];
}
public function toOnfon($notifiable)
{
return (new OnfonMessage())
->content('Your SMS message content');
}
}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security-related issues, please email erick@apexcode.dev instead of using the issue tracker.