https://github.com/laravel-notification-channels/gitter
Gitter.im notifications channel for Laravel
https://github.com/laravel-notification-channels/gitter
gitter-api laravel laravel-5-package notification-channel notifications
Last synced: 10 months ago
JSON representation
Gitter.im notifications channel for Laravel
- Host: GitHub
- URL: https://github.com/laravel-notification-channels/gitter
- Owner: laravel-notification-channels
- License: mit
- Created: 2016-08-16T21:37:14.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-09-12T05:37:41.000Z (almost 6 years ago)
- Last Synced: 2025-03-29T03:32:14.531Z (about 1 year ago)
- Topics: gitter-api, laravel, laravel-5-package, notification-channel, notifications
- Language: PHP
- Homepage: http://laravel-notification-channels.com
- Size: 23.4 KB
- Stars: 10
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Gitter.im notifications channel for Laravel
[](https://packagist.org/packages/laravel-notification-channels/gitter)
[](LICENSE.md)
[](https://travis-ci.org/laravel-notification-channels/gitter)
[](https://styleci.io/repos/65855374)
[](https://insight.sensiolabs.com/projects/f3b9fa9b-2315-4154-b8ad-f2d6661939dd)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/gitter)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/gitter/?branch=master)
[](https://packagist.org/packages/laravel-notification-channels/gitter)
This package makes it easy to send notifications using [Gitter.im](//gitter.im) with Laravel 5.5+, 6.x & 7.x.
## Contents
- [Installation](#installation)
- [Setting up the Gitter service](#setting-up-the-Gitter-service)
- [Usage](#usage)
- [Available Message methods](#available-message-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)
## Installation
Install this package with Composer:
```bash
composer require laravel-notification-channels/gitter
```
If you're using Laravel 5.x you'll also need to specify a version constraint:
```bash
composer require laravel-notification-channels/gitter -v 1.0.1
```
### Setting up the Gitter service
In order to send message to Gitter rooms, you need to obtain [Personal Access Token or application token](https://developer.gitter.im/apps).
## Usage
You can use the channel in your `via()` method inside the notification:
```php
use Illuminate\Notifications\Notification;
use NotificationChannels\Gitter\GitterMessage;
use NotificationChannels\Gitter\GitterChannel;
class TaskCompleted extends Notification
{
public function via($notifiable)
{
return [GitterChannel::class];
}
public function toGitter($notifiable)
{
return GitterMessage::create("Task #{$notifiable->id} is complete!")
->room('room_id') // optional
->from('user_or_app_access_token');
}
}
```
In order to let your notification know which Gitter room you are targeting, add the `routeNotificationForGitter` method to your Notifiable model:
```php
public function routeNotificationForGitter()
{
return 'room_id';
}
```
### Available methods
`from()`: Sets the sender's access token.
`room()`: Specifies the room id to send the notification to (overridden by `routeNotificationForGitter` if empty).
`content()`: Sets a content of the notification message. Supports Github flavoured markdown.
## 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 jhaoda@gmail.com instead of using the issue tracker.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [JhaoDa](https://github.com/jhaoda)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.