revosystems / paloma
Package to send Sms via Vonage/Nexmo
Installs: 20 430
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 3
Requires
- php: ^8.0
- illuminate/contracts: ^9.0|^10.0|^11.0
- spatie/laravel-package-tools: ^1.16.2
- vonage/client: ^4.0
Requires (Dev)
- orchestra/testbench: ^7.29
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.32
- dev-main
- 2.0.0
- 1.0.2
- 1.0.1
- 1.0
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-feature/laravel-11
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-5
- dev-dependabot/github_actions/actions/checkout-4
- dev-laravel-10
- dev-bugfix/updated-composer-dependencies
- dev-feature/REV-10276
- dev-dependabot/github_actions/ramsey/composer-install-2
- dev-feature/REV-9088-channel
- dev-feature/paloma
- dev-feature/paloma-pau
This package is auto-updated.
Last update: 2024-11-27 15:02:39 UTC
README
Installation
You can install the package via composer:
composer require revosystems/paloma
You can publish and run the migrations with:
php artisan vendor:publish --tag="paloma-migrations"
php artisan migrate
You 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'), ];
Usage
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); }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.