PHPackages                             spajz/msg - 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. spajz/msg

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

spajz/msg
=========

Simple notification system for Laravel 4

08PHP

Since Mar 25Pushed 12y ago1 watchersCompare

[ Source](https://github.com/spajz/msg)[ Packagist](https://packagist.org/packages/spajz/msg)[ RSS](/packages/spajz-msg/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Simple notification system for Laravel 4
========================================

[](#simple-notification-system-for-laravel-4)

---

- Extends Laravel MessageBag class.
- Custom template support (comes with Bootstrap3, Bootstrap2 and Foundation5 template).
- Blade string like template.
- Custom groups.
- Formats and sorting for groups and messages.
- Instant and flashable notifications...

---

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

[](#installation)

Application specific modules in Laravel 4 can be enabled by adding the following to your **"composer.json"** file:

```
"spajz/msg": "dev-master"

```

Then composer update.

Add a new provider to your providers list in **"app/config/app.php"**:

```
'Spajz\Msg\MsgServiceProvider',

```

Also add a new alias to aliases list in **"app/config/app.php"**:

```
'Msg' => 'Spajz\Msg\Facades\Msg',

```

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

[](#configuration)

If you want to edit default config file, just publish it to your app folder.

```
php artisan config:publish spajz/msg

```

Usage
-----

[](#usage)

### Add default messages

[](#add-default-messages)

```
// Default groups
Msg::success('Success message');
Msg::error('Error message');
Msg::danger('Danger message');
Msg::info('Info message');
Msg::warning('Warning message');

// Multiple messages
Msg::info(array('First message', 'Second'));
```

### Custom groups

[](#custom-groups)

You can add custom groups to config, and then use them like default groups.

```
// Custom groups
Msg::exit('Exit message');
Msg::break('Break message');

// Custom key
Msg::custom('bar', $message, 'Bar group message format :message');
Msg::custom('foo', array($foo, $bar, 'Some text'), 'Format :message');
```

### Show messages

[](#show-messages)

```
// Show all messages from the previous request
Msg::show();

// Only info messages
Msg::showInfo();

// With message format
Msg::showInfo($foo, ':key message: :message!');

// Show all messages in same request
Msg::instant();

// Only info with format
Msg::showInfoInstant($foo, ':key message: :message!');

// Custom group with format
Msg::showExitInstant($bar, ':key message: :message!');
```

### Templates

[](#templates)

```
// Add default template for all groups
Msg::setTemplate('myTemplate');

// Assign template to the specific group
Msg::setTemplates('info', 'myInfoTemplate');

// Assign Laravel Blade string like template
$blade = '';
$blade .= '@foreach ($messages as $message)';
$blade .= '{{ $message }}';
$blade .= '@endforeach';
$blade .= '';

Msg::setTemplates('info', $blade, true);

// Delete all templates
Msg::deleteTemplates();

// Delete specific group template
Msg::deleteTemplates('danger');
```

### Examples

[](#examples)

```
// Add and show message instantly
echo Msg::danger('Something is wrong')->showDangerInstant();

// Set group format
Msg::setGroupFormat('info', ':message');

// Get raw messages data
Msg::getMessages();

// Set display mode single or group
Msg::setDisplayMode('single');
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/978b6a48807770314fa13da8570235ce8fbd58c5aeb82d5fa7d2b86b5e2bee12?d=identicon)[spajz](/maintainers/spajz)

---

Top Contributors

[![spajz](https://avatars.githubusercontent.com/u/801824?v=4)](https://github.com/spajz "spajz (3 commits)")

### Embed Badge

![Health badge](/badges/spajz-msg/health.svg)

```
[![Health](https://phpackages.com/badges/spajz-msg/health.svg)](https://phpackages.com/packages/spajz-msg)
```

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
