PHPackages                             dotkernel/dot-flashmessenger - 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. dotkernel/dot-flashmessenger

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

dotkernel/dot-flashmessenger
============================

Dotkernel flash messenger component for session messages between redirects

3.7.0(7mo ago)632.6k—1.2%2[2 issues](https://github.com/dotkernel/dot-flashmessenger/issues)7MITPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI failing

Since Mar 8Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/dotkernel/dot-flashmessenger)[ Packagist](https://packagist.org/packages/dotkernel/dot-flashmessenger)[ Docs](https://github.com/dotkernel/dot-flashmessenger)[ RSS](/packages/dotkernel-dot-flashmessenger/feed)WikiDiscussions 3.0 Synced 2d ago

READMEChangelog (10)Dependencies (7)Versions (24)Used By (7)

dot-flashmessenger
==================

[](#dot-flashmessenger)

Flash messenger library for session messages between redirects. A flash message, or session message is a piece of text data that survives one request (available only in the next request). This library accepts session data as well, not just string messages, with the same behavior. The flash messenger is a convenient way to add data to the session and get it back on the next request without bothering with setting and clearing the data manually.

Documentation
-------------

[](#documentation)

Documentation is available at: .

Badges
------

[](#badges)

[![OSS Lifecycle](https://camo.githubusercontent.com/c616c6150a5347e99b0238e1cb5e002e23aa45c119008fd4da83f88ea00216ae/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c652f646f746b65726e656c2f646f742d666c6173686d657373656e676572)](https://camo.githubusercontent.com/c616c6150a5347e99b0238e1cb5e002e23aa45c119008fd4da83f88ea00216ae/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c652f646f746b65726e656c2f646f742d666c6173686d657373656e676572)[![PHP from Packagist (specify version)](https://camo.githubusercontent.com/28eff1c0946c3e1bebc4e85f57f7544a53e687916de1a3e862fe6e77c79098f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d666c6173686d657373656e6765722f332e372e30)](https://camo.githubusercontent.com/28eff1c0946c3e1bebc4e85f57f7544a53e687916de1a3e862fe6e77c79098f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d666c6173686d657373656e6765722f332e372e30)

[![GitHub issues](https://camo.githubusercontent.com/d6662bf16915e52cd5054dd0bb0c7a45d0668e48db8920018454c7066530079e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f646f746b65726e656c2f646f742d666c6173686d657373656e676572)](https://github.com/dotkernel/dot-flashmessenger/issues)[![GitHub forks](https://camo.githubusercontent.com/f775946f60f783073465d2575f0dd5c5cad90afdd8e0c0340baad289cb0beed5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f646f746b65726e656c2f646f742d666c6173686d657373656e676572)](https://github.com/dotkernel/dot-flashmessenger/network)[![GitHub stars](https://camo.githubusercontent.com/c6c3ebf364beeb9f49e8e9eb5bf69e44f667590372e9752bbc25b069add6488b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f646f746b65726e656c2f646f742d666c6173686d657373656e676572)](https://github.com/dotkernel/dot-flashmessenger/stargazers)[![GitHub license](https://camo.githubusercontent.com/eb41217457f1fdfbd516078aac65bed0bfaf4ead2276d5456609224efe827e31/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f646f746b65726e656c2f646f742d666c6173686d657373656e676572)](https://github.com/dotkernel/dot-flashmessenger/blob/3.0/LICENSE.md)

[![Build Static](https://github.com/dotkernel/dot-flashmessenger/actions/workflows/continuous-integration.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-flashmessenger/actions/workflows/continuous-integration.yml)[![codecov](https://camo.githubusercontent.com/a49654e9b542ca6d3819bb37794dc4315bee38e0efbeb332c048f5a02080dde0/68747470733a2f2f636f6465636f762e696f2f67682f646f746b65726e656c2f646f742d666c6173686d657373656e6765722f67726170682f62616467652e7376673f746f6b656e3d42345741543352594b4a)](https://codecov.io/gh/dotkernel/dot-flashmessenger)[![PHPStan](https://github.com/dotkernel/dot-flashmessenger/actions/workflows/static-analysis.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-flashmessenger/actions/workflows/static-analysis.yml)

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

[](#installation)

Run the following command in your project folder

```
composer require dotkernel/dot-flashmessenger
```

This will also install `laminas/laminas-session` as session handling is based on this library. Next, merge the `ConfigProvider` to your application's configuration.

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

[](#configuration)

```
return [
    'dot_flashmessenger' => [
        'namespace' => 'flash messages session namespace name'
    ],
];
```

Sets the session namespace to be used for all flash messages and data.

Usage
-----

[](#usage)

If following the installation step, you'll already have a FlashMessenger service in the service manager. Inject this service in your classes, wherever you need flash messages.

### Getting the service in a factory

[](#getting-the-service-in-a-factory)

```
$container->get(FlashMessengerInterface::class);
```

### Using the flash messenger service

[](#using-the-flash-messenger-service)

To add and retrieve text messages

```
$this->flashMessenger->addMessage('error', 'This is a error flash message');
//on the next request you can get all messages from a namespace, or all messages from all namespaces if the namespace is omitted
$this->flashMessenger->getMessages('error');
```

Adding general data, not just messages, has a different method for that, accepting data as key/value pairs

```
$this->flashMessenger->addData('myData', $someData);
// next request
$this->flashMessenger->getData('myData');
```

There are also some predefined namespaces, along with shortcuts to add a message in the predefined namespaces

```
FlashMessengerInterface::ERROR_NAMESPACE
FlashMessengerInterface::WARNING_NAMESPACE
FlashMessengerInterface::INFO_NAMESPACE
FlashMessengerInterface::SUCCESS_NAMESPACE
```

using the methods:

```
public function addError(string|array $error);

public function addInfo(string|array $info);

public function addWarning(string|array $warning);

public function addSuccess(string|array $success);
```

FlashMessengerRenderer
----------------------

[](#flashmessengerrenderer)

A class that is able to parse the content of the flash messenger service in an HTML format. It uses the TemplateInterface to parse a partial, sending to the partial template the messages, the service and the renderer itself. There is also a Twig extension provided in [dot-twigrenderer](https://github.com/dotkernel/dot-twigrenderer), for easy parsing of messages blocks.

Registered services
-------------------

[](#registered-services)

```
Dot\FlashMessenger\FlashMessengerInterface::class
```

The flash messenger service

```
Dot\FlashMessenger\View\RendererInterface::class
```

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance57

Moderate activity, may be stable

Popularity35

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~151 days

Recently: every ~141 days

Total

22

Last Release

229d ago

Major Versions

0.2.0 → v1.0.02018-05-04

v1.0.0 → 2.0.x-dev2020-01-30

v2.0.0 → v3.02020-04-17

PHP version history (7 changes)0.1.0PHP ^7.1

2.0.x-devPHP ^7.2

v3.0PHP ^7.4

3.2.0PHP ^7.4 || ~8.0.0 || ~8.1.0

3.4.0PHP ~8.1.0 || ~8.2.0

3.4.2PHP ~8.1.0 || ~8.2.0 || ~8.3.0

3.7.0PHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1156873?v=4)[Dotkernel](/maintainers/dotkernel)[@dotkernel](https://github.com/dotkernel)

---

Top Contributors

[![n3vrax](https://avatars.githubusercontent.com/u/5805542?v=4)](https://github.com/n3vrax "n3vrax (24 commits)")[![arhimede](https://avatars.githubusercontent.com/u/22009710?v=4)](https://github.com/arhimede "arhimede (12 commits)")[![alexmerlin](https://avatars.githubusercontent.com/u/4542449?v=4)](https://github.com/alexmerlin "alexmerlin (12 commits)")[![Jurj-Bogdan](https://avatars.githubusercontent.com/u/53825374?v=4)](https://github.com/Jurj-Bogdan "Jurj-Bogdan (8 commits)")[![Howriq](https://avatars.githubusercontent.com/u/63609103?v=4)](https://github.com/Howriq "Howriq (3 commits)")[![MarioRadu](https://avatars.githubusercontent.com/u/10761919?v=4)](https://github.com/MarioRadu "MarioRadu (3 commits)")[![marioradu05](https://avatars.githubusercontent.com/u/10761919?v=4)](https://github.com/marioradu05 "marioradu05 (3 commits)")[![gabidj](https://avatars.githubusercontent.com/u/3998573?v=4)](https://github.com/gabidj "gabidj (3 commits)")[![kakapiciu](https://avatars.githubusercontent.com/u/30651114?v=4)](https://github.com/kakapiciu "kakapiciu (2 commits)")

---

Tags

laminasmezzioflashmessenger

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dotkernel-dot-flashmessenger/health.svg)

```
[![Health](https://phpackages.com/badges/dotkernel-dot-flashmessenger/health.svg)](https://phpackages.com/packages/dotkernel-dot-flashmessenger)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M126](/packages/mezzio-mezzio)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[anthropic-ai/sdk

Anthropic PHP SDK

163583.3k17](/packages/anthropic-ai-sdk)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)

PHPackages © 2026

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