Messages Component for Laravel and Orchestra Platform

Installs: 15 492

Dependents: 2

Stars: 3

Watchers: 1

Forks: 1

Language: PHP

v3.1.2 2015-06-16 11:43 UTC


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

Latest Stable Version Total Downloads MIT License Build Status Coverage Status Scrutinizer Quality Score

Table of Content

Version Compatibility

Laravel Messages
4.2.x 2.2.x
5.0.x 3.0.x
5.1.x 3.1.x
5.2.x 3.2.x@dev


To install through composer, simply put the following in your composer.json file:

    "require": {
        "orchestra/messages": "~3.0"

And then run composer install from the terminal.

Quick Installation

Above installation can also be simplify by using the following command:

composer require "orchestra/messages=~3.0"


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

'providers' => [

    // ...



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

'aliases' => [

    // ...

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


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

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

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


$message = Messages::retrieve();

if ($message instanceof Orchestra\Messages\MessageBag) {
    $message->setFormat('<div class="alert alert-:key">:message</div>');

    foreach (['error', 'info', 'success'] as $key) {
        if ($message->has($key)) {
            echo implode('', $message->get($key));