PHPackages                             orchestra/messages - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. orchestra/messages

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

orchestra/messages
==================

Messages Component for Laravel and Orchestra Platform

v6.1.0(5y ago)491.4k↓50%11MITPHPPHP ^7.3 || ^8.0

Since Aug 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/orchestral/messages)[ Packagist](https://packagist.org/packages/orchestra/messages)[ Docs](http://orchestraplatform.com/docs/latest/components/messages/)[ Fund](https://paypal.me/crynobone)[ Fund](https://liberapay.com/crynobone)[ RSS](/packages/orchestra-messages/feed)WikiDiscussions 6.x Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (33)Used By (1)

Messages Component for Laravel and Orchestra Platform
=====================================================

[](#messages-component-for-laravel-and-orchestra-platform)

Messages Component bring a unified notification support for Laravel and Orchestra Platform.

[![tests](https://github.com/orchestral/messages/workflows/tests/badge.svg?branch=6.x)](https://github.com/orchestral/messages/actions?query=workflow%3Atests+branch%3A6.x)[![Latest Stable Version](https://camo.githubusercontent.com/c520e66d70271951d9af8dceba4f0be226f4ab512f40ca637d8ef0e93845119e/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f6d657373616765732f76657273696f6e)](https://packagist.org/packages/orchestra/messages)[![Total Downloads](https://camo.githubusercontent.com/54c1d191de2129cbf8424da349eeb868cd82a76a538331a6434f3670296b58e9/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f6d657373616765732f646f776e6c6f616473)](https://packagist.org/packages/orchestra/messages)[![Latest Unstable Version](https://camo.githubusercontent.com/88993c51383222d4093c4a20f5db617898cccb4e5360199b42adbdd539354293/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f6d657373616765732f762f756e737461626c65)](//packagist.org/packages/orchestra/messages)[![License](https://camo.githubusercontent.com/0e7297efe817ef7b73e62f34ba6a33aeedf5448891344cc50bdc050cc19ce150/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f6d657373616765732f6c6963656e7365)](https://packagist.org/packages/orchestra/messages)[![Coverage Status](https://camo.githubusercontent.com/197993fed6f0d4fb0993c653a624cc02d6bb4e2ad259e75daf1558883d1fb724/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f72636865737472616c2f6d657373616765732f62616467652e7376673f6272616e63683d362e78)](https://coveralls.io/github/orchestral/messages?branch=6.x)

Version Compatibility
---------------------

[](#version-compatibility)

LaravelMessages5.5.x3.5.x5.6.x3.6.x5.7.x3.7.x5.8.x3.8.x6.x4.x7.x5.x8.x6.xInstallation
------------

[](#installation)

To install through composer, run the following command from terminal:

```
composer require "orchestra/messages"
```

Configuration
-------------

[](#configuration)

Add `Orchestra\Messages\MessagesServiceProvider` service provider in `config/app.php`.

```
'providers' => [

    // ...

    Orchestra\Messages\MessagesServiceProvider::class,
],
```

### Aliases

[](#aliases)

You might want to add `Orchestra\messages\Facades\Messages` to class aliases in `config/app.php`:

```
'aliases' => [

    // ...

    'Messages' => Orchestra\Support\Facades\Messages::class,
],
```

Usage
-----

[](#usage)

### Adding a Message

[](#adding-a-message)

Adding a message is as easy as following:

```
Messages::add('success', 'A successful message');
```

You can also chain messages:

```
Messages::add('success', 'A successful message')
    ->add('error', 'Some error');
```

### Extending a Message to Current Request

[](#extending-a-message-to-current-request)

There might be situation where you need to extend a message to the current response instead of the following request. You can do this with:

```
Messages::extend(function ($message) {
    $message->add('info', 'Read-only mode');
});
```

### Displaying the Message in a View

[](#displaying-the-message-in-a-view)

Here's an example how you can display the message:

```
