An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Gitter.im notifications channel for Laravel

[![Latest Version on Packagist](https://img.shields.io/packagist/v/laravel-notification-channels/gitter.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/gitter)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/laravel-notification-channels/gitter/master.svg?style=flat-square)](https://travis-ci.org/laravel-notification-channels/gitter)
[![StyleCI](https://styleci.io/repos/65855374/shield)](https://styleci.io/repos/65855374)
[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/f3b9fa9b-2315-4154-b8ad-f2d6661939dd.svg?style=flat-square)](https://insight.sensiolabs.com/projects/f3b9fa9b-2315-4154-b8ad-f2d6661939dd)
[![Quality Score](https://img.shields.io/scrutinizer/g/laravel-notification-channels/gitter.svg?style=flat-square)](https://scrutinizer-ci.com/g/laravel-notification-channels/gitter)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/laravel-notification-channels/gitter/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/laravel-notification-channels/gitter/?branch=master)
[![Total Downloads](https://img.shields.io/packagist/dt/laravel-notification-channels/gitter.svg?style=flat-square)](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.