You can install the package via composer:
composer require revosystems/palomaYou can publish and run the migrations with:
php artisan vendor:publish --tag="paloma-migrations"
php artisan migrateYou can publish the config file with:
php artisan vendor:publish --tag="paloma-config"This is the contents of the published config file:
return [
'sms_from' => env('VONAGE_FROM_NUMBER', 'Vonage APIs'),
'vonage_key' => env('VONAGE_KEY'),
'vonage_secret' => env('VONAGE_SECRET'),
];You can send sms directly using the facade or send sms using the notification feature from laravel.
To send sms directly:
use Revo\Paloma\Facades\Paloma;
Paloma::send(string $phone, string $message, string $service, ?string $from = null)The phone must contain the country code prefix (34 or +34). A wrong phone will send anything. Vonage cannot validate the phone.
To notify using Paloma you should add the channel and method to your notification:
use Revo\Paloma\PalomaChannel;
use Revo\Paloma\PalomaMessage;
public function via($notifiable)
{
return [PalomaChannel::class];
}
public function toPaloma($notifiable): PalomaMessage
{
return new PalomaMessage(string $message, string $service, ?string $from = null);
}Also the notifieble instance should have the $full_phone property. On a Laravel model can be a computed property as so:
public function getFullPhoneAttribute(): string
{
return "34" . trim($this->phone);
}composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.