https://github.com/baspa/spryng
  
  
    📲 Spryng Notifications Channel for Laravel 
    https://github.com/baspa/spryng
  
        Last synced: 3 months ago 
        JSON representation
    
📲 Spryng Notifications Channel for Laravel
- Host: GitHub
- URL: https://github.com/baspa/spryng
- Owner: Baspa
- License: mit
- Created: 2024-06-13T19:24:54.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-06-14T18:22:28.000Z (over 1 year ago)
- Last Synced: 2025-02-26T06:36:09.272Z (8 months ago)
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- 
            Metadata Files:
            - Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
 
Awesome Lists containing this project
README
          # Spryng Notification Channel
[](https://packagist.org/packages/laravel-notification-channels/spryng)
[](LICENSE.md)
[](https://travis-ci.org/laravel-notification-channels/spryng)
[](https://styleci.io/repos/:style_ci_id)
[](https://insight.sensiolabs.com/projects/:sensio_labs_id)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/spryng)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/spryng/?branch=master)
[](https://packagist.org/packages/laravel-notification-channels/spryng)
📲  [Spryng](https://www.spryng.nl/en/) Notifications Channel for Laravel
## Contents
- [Installation](#installation)
	- [Setting up the Spryng service](#setting-up-the-Spryng-service)
- [Usage](#usage)
	- [Available Message methods](#available-message-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)
## Installation
```bash
composer require laravel-notification-channels/spryng
```
Add the configuration to your `services.php` config file:
```php
'spryng' => [
    'key' => env('SPRYNG_API_KEY'),
]
```
### Setting up the Spryng service
You'll need a Spryng account. Head over to their [website](https://www.spryng.nl/en/) and create or login to your account.
Head to your `Profile` and then `Security` in the sidebar to generate a set of API keys.
## Usage
You can use the channel in your `via()` method inside the notification:
```php
use Illuminate\Notifications\Notification;
use \NotificationChannels\Spryng\SpryngMessage;
use \NotificationChannels\Spryng\SpryngChannel;
class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [SpryngChannel::class];
    }
    public function toSpryng($notifiable)
    {
        return (new SpryngMessage)
			->setBody("Task #{$notifiable->id} is complete!")
			->setRecipients($notifiable->phone_number)
			->setOriginator(config('app.name'));
    }
}
```
Make sure your Notifiable model has a `phone_number` attribute, which will be used to send the SMS. Also make sure it's a valid phone number.
### Available Message methods
- `setBody('')`: Accepts a string value for the message body.
- `setRecipients('')`: Accepts a string or array value for the recipient(s) phone number.
- `setOriginator('')`: Accepts a string value for the sender name.
## 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 hello@baspa.dev instead of using the issue tracker.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [Bas van Dinther](https://github.com/Baspa)
- [Spryng](https://www.spryng.nl/en/)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.