PHPackages                             pbjuhr/flashmessages - 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. pbjuhr/flashmessages

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

pbjuhr/flashmessages
====================

Php class for generating and displaying messages to the user.

162PHP

Since Jan 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/pbjuhr/FlashMessages)[ Packagist](https://packagist.org/packages/pbjuhr/flashmessages)[ RSS](/packages/pbjuhr-flashmessages/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/e7ebe44feef6ce7d95db8ce30093422ad568dc85767c85d7d9fd55af16e0beb3/68747470733a2f2f7472617669732d63692e6f72672f70626a7568722f466c6173684d657373616765732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pbjuhr/FlashMessages)[![Code Coverage](https://camo.githubusercontent.com/79d159058868c47bf24b7bcc9628a15dfb139b980b31242db0e6a98dc92baead/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70626a7568722f466c6173684d657373616765732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pbjuhr/FlashMessages/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/efcd01058029f8fc121751ee2fc02f4bf958b6fb1b5d2daa799fb28db3ffac6a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70626a7568722f466c6173684d657373616765732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pbjuhr/FlashMessages/?branch=master)

FlashMessages
=============

[](#flashmessages)

Php class for generating and displaying flash messages.

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

[](#how-to-use)

\###1. Download

The easiest way is to install using composer. Add to your composer.json:

```
"require": {
    "pbjuhr/flashmessages": "dev-master"
},
```

Do not forget to run composer update!

Don't wanna use Composer? Download .zip from this page!

\###2. Include in your project Session must be started before using FlashMessages.
To include FlashMessages in your ANAX-application, add the class in your front controller:

```
$di->setShared('FlashMessages', function() use ($di) {
    $FlashMessages = new \PBjuhr\FlashMessages\FlashMessages($di);
    return $FlashMessages;
});
```

\####Not using ANAX? Replace FlashMessages.php with FlashMessages\_NoANAX.php and include it in your project.

```
require "FlashMessages.php"
$myFlashMessagesObject = new FlashMessages();
```

\###3. Generate messages Four different types of messages can be generated. Info, Success, Warnings or Errors! Add a message using one of the following functions:

```
$content = "Heads up! This is a flash message.";
$type = "info"; /* Must be: "info", "success", "warning" or "error" */

$myFlashMessagesObject->add($type, $content);
$myFlashMessagesObject->addInfo($content);
$myFlashMessagesObject->addSuccess($content);
$myFlashMessagesObject->addWarning($content);
$myFlashMessagesObject->addError($content);
```

Here's an example how to add a message in ANAX:

```
$app->FlashMessages->addSuccess($content);
```

\###4. Display messages To display messages, simply call the function getHtml($class). $class is an optional parameter that sets a css-class to the div objects. Standard css-class is "alert" for bootstrap users!

```
echo $myFlashMessagesObject->getHtml("myCssClass");
```

Each message gets printed in the following format:

```
Content
```

Where "type" is either "success", "info", "warning" or "danger". (Bootstrap standard) Note! The getHtml sets the messages session to NULL before returning.

License
-------

[](#license)

MIT

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

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/76744a921844713410551f721395eb5ba58dea494f9421ced1026efb1c74cd27?d=identicon)[pbjuhr](/maintainers/pbjuhr)

---

Top Contributors

[![pbjuhr](https://avatars.githubusercontent.com/u/3340593?v=4)](https://github.com/pbjuhr "pbjuhr (38 commits)")

### Embed Badge

![Health badge](/badges/pbjuhr-flashmessages/health.svg)

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

###  Alternatives

[lukapeharda/tailwindcss-color-palette-generator

Generate TailwindCSS color palette from a single color.

22113.3k1](/packages/lukapeharda-tailwindcss-color-palette-generator)[flagstudio/laravel-paginate

Different paginate macros for laravel eloquent builder and collection

158.5k](/packages/flagstudio-laravel-paginate)

PHPackages © 2026

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