PHPackages                             sebkay/noticeable - 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. sebkay/noticeable

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

sebkay/noticeable
=================

2.2.0(5y ago)81.1kMITPHPPHP &gt;=7.2

Since Jun 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/SebKay/noticeable)[ Packagist](https://packagist.org/packages/sebkay/noticeable)[ GitHub Sponsors](https://github.com/SebKay)[ RSS](/packages/sebkay-noticeable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (8)Used By (0)

[![Test PHP](https://github.com/SebKay/noticeable/workflows/Test%20PHP/badge.svg)](https://github.com/SebKay/noticeable/workflows/Test%20PHP/badge.svg)

Noticeable
==========

[](#noticeable)

Easily output a simple flash message/notice to the page, but only once.

How to install
--------------

[](#how-to-install)

It's recommended you install this package via [Composer](https://getcomposer.org/).

```
composer require sebkay/noticeable
```

The notice is session based and will be removed on the next page refresh.

First you'll need to start a session. Put this at the very start of your project files (so it's the first thing that loads):

```
session_start();
```

Then include the Composer autoloader so you have access to the package.

```
require __DIR__ . '/vendor/autoload.php';
```

How to use
----------

[](#how-to-use)

### Setting the notice

[](#setting-the-notice)

You can set a notice using the `::set` static method. You need to pass a `Noticeable\NoticeContent` object which accepts a `message` and a `type`.

The type must be either `info`, `success` or `error`. Anything else with throw an `InvalidArgumentException` exception.

```
use Noticeable\Notice;
use Noticeable\NoticeContent;

Notice::set(
    new NoticeContent('Please enter an email address.', 'error')
);
```

### Getting the notice

[](#getting-the-notice)

When you get a notice it will return a `Noticeable\NoticeContent` object, like so:

```
$notice = Notice::get();

print_r($notice);

// Will return
Noticeable\NoticeContent Object
(
    [message:protected] => Please enter an email address.
    [type:protected] => error
    [allowed_types:protected] => Array
        (
            [0] => info
            [1] => success
            [2] => error
        )

)
```

### Available Methods

[](#available-methods)

```
$notice = Notice::get();

$notice->message(); // (string) Please enter an email address.

$notice->type(); // (string) error
```

### Using the notice

[](#using-the-notice)

Once you have the notice you can do whatever you want with it, like load a PHP file with some HTML to format the message.

#### Twig

[](#twig)

I'm a big fan of [Twig](https://github.com/twigphp/Twig), so I would do something like this:

```
$notice = Notice::get();

echo $twig->render('notice.twig', [
    'message' => $notice->message(),
    'type'    => $notice->type()
]);
```

Then I'll have the `notice.twig` file laid out like so:

```
{% if message %}
    {% if type == 'info' %}
        {% set css_class = 'notice--info' %}
    {% elseif type == 'success' %}
        {% set css_class = 'notice--success' %}
    {% elseif type == 'error' %}
        {% set css_class = 'notice--error' %}
    {% endif %}

            {{ message | raw }}

{% endif %}
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.2% 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.

###  Release Activity

Cadence

Every ~27 days

Recently: every ~21 days

Total

7

Last Release

1994d ago

Major Versions

1.x-dev → 2.0.02020-09-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/0eb0c125a95bbb96a00c31b474c67d7761c87964bd9ba973bd3e4b896097bdb5?d=identicon)[SebKay](/maintainers/SebKay)

---

Top Contributors

[![SebKay](https://avatars.githubusercontent.com/u/1873695?v=4)](https://github.com/SebKay "SebKay (59 commits)")[![DavidGoodwin](https://avatars.githubusercontent.com/u/203929?v=4)](https://github.com/DavidGoodwin "DavidGoodwin (5 commits)")

---

Tags

composer-packageflash-messageflash-messagesflash-noticeflash-notificationsnoticephpphp-package

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sebkay-noticeable/health.svg)

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

###  Alternatives

[polonskiy/phproutine

Goroutines in PHP

60122.0k](/packages/polonskiy-phproutine)[bornfreee/tactician-domain-events-bundle

Bundle to integrate Tactician Domain Events library with Symfony project

10138.6k](/packages/bornfreee-tactician-domain-events-bundle)[php-lrpm/php-lrpm

PHP Long Running Process Manager

187.8k1](/packages/php-lrpm-php-lrpm)

PHPackages © 2026

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