PHPackages                             elfsundae/laravel-bearychat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. elfsundae/laravel-bearychat

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

elfsundae/laravel-bearychat
===========================

Laravel integration for BearyChat.

1.6.0(5y ago)7342.6k112MITPHPPHP &gt;=5.6.4

Since Jul 5Pushed 5y ago2 watchersCompare

[ Source](https://github.com/ElfSundae/laravel-bearychat)[ Packagist](https://packagist.org/packages/elfsundae/laravel-bearychat)[ Docs](https://github.com/ElfSundae/laravel-bearychat)[ RSS](/packages/elfsundae-laravel-bearychat/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (22)Used By (2)

BearyChat for Laravel
=====================

[](#bearychat-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2937d81a60fb8ce3e685b0146310346834bff436be734b999e9eb7826580620e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6673756e6461652f6c61726176656c2d6265617279636861742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elfsundae/laravel-bearychat)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/cce98393c78745fda36e069d4fb9805144a84f9132228a01c4cb4ec088999b4d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f456c6653756e6461652f6c61726176656c2d6265617279636861742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ElfSundae/laravel-bearychat)[![StyleCI](https://camo.githubusercontent.com/3006715a8844661d553f95d0585f78563980e9c07be094944a1298e7ffe71468/68747470733a2f2f7374796c6563692e696f2f7265706f732f36323438353335322f736869656c64)](https://styleci.io/repos/62485352)[![SensioLabsInsight](https://camo.githubusercontent.com/303ce4194e81b3fee6451e8f266771c4042f8d5706b56b77a6fbbd73ba805c1b/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f33313162663737322d623933362d343233632d616434632d3037663462343430373862372e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/311bf772-b936-423c-ad4c-07f4b44078b7)[![Quality Score](https://camo.githubusercontent.com/f1a22a2af3817076dfc1676884a9fcf5e0a6d7414e9fd06d2e8179df5becdf06/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f456c6653756e6461652f6c61726176656c2d6265617279636861742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ElfSundae/laravel-bearychat)[![Code Coverage](https://camo.githubusercontent.com/cf7f672937c2d6bda5bcceb4ca54d5596bc5192e8f7729dce96c2c3adb734680/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f456c6653756e6461652f6c61726176656c2d6265617279636861742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ElfSundae/laravel-bearychat/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/855e86415fbcfe8d5a2b49745e6a09a972aeda25a6322c021c9c9b63b62d7530/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6673756e6461652f6c61726176656c2d6265617279636861742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elfsundae/laravel-bearychat)

The Laravel integration for [BearyChat](https://github.com/ElfSundae/bearychat) to send robot messages.

This package is compatible with Laravel 4/5/6/7/8 and Lumen.

> - 🇨🇳 [**中文文档**](README_zh.md)
> - **Laravel Notification Channel:** [BearyChatChannel](https://github.com/laravel-notification-channels/bearychat)

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Laravel 5/6/7/8](#laravel-5678)
    - [Laravel 4](#laravel-4)
    - [Lumen](#lumen)
- [Usage](#usage)
    - [Basic Usage](#basic-usage)
    - [Asynchronous Message](#asynchronous-message)
    - [Sending Laravel Exceptions](#sending-laravel-exceptions)
    - [Creating Outgoing Responses](#creating-outgoing-responses)
    - [Customize Guzzle](#customize-guzzle)
- [Changelog](#changelog)
- [Testing](#testing)
- [License](#license)

Installation
------------

[](#installation)

You can install this package using the [Composer](https://getcomposer.org) manager:

```
$ composer require elfsundae/laravel-bearychat
```

After updating composer, you may configure your app according to the following steps:

### Laravel 5/6/7/8

[](#laravel-5678)

> For Laravel 5.5+, the service provider will automatically get registered.

Add the service provider to the `providers` array in `config/app.php`:

```
ElfSundae\BearyChat\Laravel\ServiceProvider::class,
```

Register facade:

```
'BearyChat' => ElfSundae\BearyChat\Laravel\BearyChat::class,
```

Then publish the config file:

```
$ php artisan vendor:publish --tag=bearychat
```

Next, configure your BearyChat clients by editing the config file in `config/bearychat.php`.

### Laravel 4

[](#laravel-4)

Please install version [`1.1.x`](https://github.com/ElfSundae/laravel-bearychat/tree/1.1.x):

```
$ composer require elfsundae/laravel-bearychat:1.1.*
```

Add the service provider to the `providers` array in `config/app.php`:

```
'ElfSundae\BearyChat\Laravel\ServiceProvider',
```

Then publish the config file:

```
$ php artisan config:publish elfsundae/laravel-bearychat
```

Next, configure your BearyChat clients by editing the config file in `app/config/packages/elfsundae/laravel-bearychat/config.php`.

### Lumen

[](#lumen)

Register the service provider in `bootstrap/app.php`:

```
$app->register(ElfSundae\BearyChat\Laravel\ServiceProvider::class);
```

Then copy the config file from this package to your app's `config/bearychat.php`:

```
$ cp vendor/elfsundae/laravel-bearychat/config/bearychat.php config/bearychat.php
```

Now you can configure your BearyChat clients by editing `config/bearychat.php`.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

You can obtain the BearyChat `Client` using the `BearyChat` facade, or the `bearychat()` helper function.

```
BearyChat::send('message');

bearychat()->sendTo('@elf', 'Hi!');
```

You may access various clients via the `client` method of the `BearyChat` facade, or pass a client name to the `bearychat()` function. The name should correspond to one of the clients listed in your BearyChat configuration file.

```
BearyChat::client('dev')->send('foo');

bearychat('admin')->send('bar');
```

> **For more advanced usage, please [read the documentation](https://github.com/ElfSundae/bearychat/blob/master/README.md) of the BearyChat PHP package.**

### Asynchronous Message

[](#asynchronous-message)

Sending a BearyChat message actually requests the Incoming Webhook via synchronous HTTP, so it will slow down your app execution. For sending asynchronous messages, You can queue them using Laravel's awesome [queue system](https://laravel.com/docs/queues).

Here is an example of the Queueable Job for Laravel 5.3:

```
