https://github.com/laravel-notification-channels/plivo
Plivo notifications channel for Laravel
https://github.com/laravel-notification-channels/plivo
laravel plivo plivo-notifications-channel sms-notifications
Last synced: about 2 months ago
JSON representation
Plivo notifications channel for Laravel
- Host: GitHub
- URL: https://github.com/laravel-notification-channels/plivo
- Owner: laravel-notification-channels
- License: mit
- Created: 2016-08-15T07:58:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-09-08T20:52:19.000Z (almost 3 years ago)
- Last Synced: 2025-03-29T03:32:14.563Z (3 months ago)
- Topics: laravel, plivo, plivo-notifications-channel, sms-notifications
- Language: PHP
- Homepage: https://laravel-notification-channels.com
- Size: 26.4 KB
- Stars: 9
- Watchers: 7
- Forks: 19
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Plivo notifications channel for Laravel
[](https://packagist.org/packages/laravel-notification-channels/plivo)
[](LICENSE.md)
[](https://travis-ci.org/laravel-notification-channels/plivo)
[](https://styleci.io/repos/65715218)
[](https://insight.sensiolabs.com/projects/f4bd99c4-092c-4e36-a319-826f142c1ec4)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/plivo)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/plivo/?branch=master)
[](https://packagist.org/packages/laravel-notification-channels/plivo)This package makes it easy to send SMS notifications using [Plivo](https://plivo.com) with Laravel 6.x and higher.
## Contents
- [Installation](#installation)
- [Setting up the Plivo service](#setting-up-the-Plivo-service)
- [Usage](#usage)
- [Available Message methods](#available-message-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)## Installation
Install the package via composer:
```bash
composer require laravel-notification-channels/plivo
```### Setting up your Plivo service
Log in to your [Plivo dashboard](https://manage.plivo.com/dashboard/) and grab your Auth Id, Auth Token and the phone number you're sending from. Add them to `config/services.php`.```php
// config/services.php
...
'plivo' => [
'auth_id' => env('PLIVO_AUTH_ID'),
'auth_token' => env('PLIVO_AUTH_TOKEN'),
// Country code, area code and number without symbols or spaces
'from_number' => env('PLIVO_FROM_NUMBER'),
],
```## Usage
Follow Laravel's documentation to add the channel your Notification class:
```php
use Illuminate\Notifications\Notification;
use NotificationChannels\Plivo\PlivoChannel;
use NotificationChannels\Plivo\PlivoMessage;public function via($notifiable)
{
return [PlivoChannel::class];
}public function toPlivo($notifiable)
{
return (new PlivoMessage)
->content('This is a test SMS via Plivo using Laravel Notifications!');
}
```Add a `routeNotificationForPlivo` method to your Notifiable model to return the phone number:
```php
public function routeNotificationForPlivo()
{
// Country code, area code and number without symbols or spaces
return preg_replace('/\D+/', '', $this->phone_number);
}
```### Available methods
* `content()` - (string), SMS notification body
* `from()` - (integer) Override default from number## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```## Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [Sid K](https://github.com/koomai)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.