PHPackages                             codenest/ahem - 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. codenest/ahem

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

codenest/ahem
=============

A simple laravel packege for creating, managing and displaying single and multiple request notification messages.

425PHP

Since Jun 19Pushed 11y ago2 watchersCompare

[ Source](https://github.com/codenest/ahem)[ Packagist](https://packagist.org/packages/codenest/ahem)[ RSS](/packages/codenest-ahem/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Ahem!!!
=======

[](#ahem)

A Laravel 4 package for creating and managing notifications
-----------------------------------------------------------

[](#a-laravel-4-package-for-creating-and-managing-notifications)

Ahem is a simplly enables you to :-

- Create notifications and add their messages.
- Add multiple messages on a sinlge notification.
- Define custom notification types or extend existing ones.
- Easily define how each notification type is rendered.
- Easily render your notifications in HTML or JSON.

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

[](#installation)

Add the following to your `composer.json`

```
"codenest/ahem": "dev-master"

```

Then run `composer update` in your terminal.

In order to start using Ahem, you need to add it's service provider and facade in your application. To do this open `app/config/app.php`.

In your `providers` array add

```
'Codenest\Ahem\AhemServiceProvider',
```

And in your `aliases` array add

```
'Ahem'  =>  'Codenest\Ahem\Facades\Ahem',
```

Configuration.
--------------

[](#configuration)

By default, Ahem has `success`, `error`, `warning` and `info` notification types defined in its configuration file and you may wish to add your own, edit or remove some of these notification types. To do this, you need to publish the config file to your app by running the command below.

```
php artisan config:publish codenest/ahem

```

========================

Basic Usage.
------------

[](#basic-usage)

Before getting into details, lets have a look at how we can use Ahem's default notification types.

### Adding Notifications

[](#adding-notifications)

#### Adding single message notifications.

[](#adding-single-message-notifications)

```
Ahem::success()->message('Login was successfully. Welcome.');
Ahem::error()->message('Wrong email or password.');
Ahem::info()->message('Somebody send you a message');
Ahem::warning()->message('Your account subscription will expire in 3 days. Please renew.');
```

#### Giving notifications their unique `id`

[](#giving-notifications-their-unique-id)

```
Ahem::success('login_success')->message('Login was successfully. Welcome.');
Ahem::error('login_error')->message('Wrong email or password.');
```

In the above case, I have used `login_success` and `login_error` as the ids. This id uniquely identified the notification and I recommend it if you have multiple notifications on one request and you would like to reference some of them at a later stage. As you saw in our first example, the `id` is not necessary. Your can leave it blank and the notification will be assigned a unique integer `id`.

#### Multiple messages and notifications headings.

[](#multiple-messages-and-notifications-headings)

Adding an array of messages with an heading.

```
Ahem::error('login_error')
		->messages(array('email' => 'Enter a valid email address', 'password' => 'The password field is required'))
		->heading('Something went wrong');
```

Adding validation error messages.

```
public function postLogin()
{
    $rules = array (
                'email' => 'email|required',
                'password'   => 'required'
        );
   $validator = Validator::make( Input::all(), $rules);
   if($validator->passes())
   {
       Ahem::success('login_success')->message('Login was successfully. Welcome!!');
	   return Redirect::to('/');
   }
   else
   {
      Ahem::error('login_error')->messages($validator->messages())->heading('Something went wrong.');
	  return Redirect::back()->withInput();
   }
}
```

#### Notifications for the same requests.

[](#notifications-for-the-same-requests)

As we are going to see later, notifications are automatically flashed into the session on creation and cleared once they are rendered, you might want to add notifications for a single requests that don't need to be flashed. We do this by simply setting `flashable` to `false`

```
Ahem::error('login_error')->message('Login error. Try again.')->flashable(false);
```

=======================

### Rendering Notifications.

[](#rendering-notifications)

#### Rendering all avaliable notifictions.

[](#rendering-all-avaliable-notifictions)

```
{{ Ahem::renderAll() }}
```

#### Rendering all available notifications for specific types.

[](#rendering-all-available-notifications-for-specific-types)

```
{{ Ahem::renderAll(array('error', 'warning')) }}
```

#### Rendering all notifications for a given type.

[](#rendering-all-notifications-for-a-given-type)

```
{{ Ahem::renderError() }}
{{ Ahem::renderSuccess() }}
```

#### Rendering a specific notification.

[](#rendering-a-specific-notification)

```
{{ Ahem::renderError('login_error') }}
{{ Ahem::renderSuccess('login_success') }}
```

### Rendering notifications without clearing them from the session.

[](#rendering-notifications-without-clearing-them-from-the-session)

I had mentioned before that after you render a flashed notification, It automatically be cleared from the session. In some cases, we might need to keep some notifications in the session even after they are rendered.

#### Render but keep all avaliable notifictions.

[](#render-but-keep-all-avaliable-notifictions)

```
{{ Ahem::renderAllButKeep() }}
```

#### Rendering but keep all available notifications for specific types.

[](#rendering-but-keep-all-available-notifications-for-specific-types)

```
{{ Ahem::renderAllButKeep(array('error', 'warning')) }}
```

#### Rendering but keep all notifications for a given type.

[](#rendering-but-keep-all-notifications-for-a-given-type)

```
{{ Ahem::renderButKeepError() }}
{{ Ahem::renderButKeepSuccess() }}
```

#### Rendering but keep a specific notification.

[](#rendering-but-keep-a-specific-notification)

```
{{ Ahem::renderButKeepError('login_error') }}
{{ Ahem::renderButKeepError('login_success') }}
```

Extending
---------

[](#extending)

---

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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/1d55265b6d1f06d4d42a28e06b71bdec921e3f1eccff0a0bd2b7bb9f82eb07db?d=identicon)[davidkyalo](/maintainers/davidkyalo)

### Embed Badge

![Health badge](/badges/codenest-ahem/health.svg)

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

###  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)
