PHPackages                             gajus/paddy - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. gajus/paddy

ActiveLibrary[Queues &amp; Workers](/categories/queues)

gajus/paddy
===========

Session based (flash) messaging utility.

0.1.3(11y ago)225[1 issues](https://github.com/gajus/paddy/issues)BSD-3-ClausePHPPHP &gt;=5.4

Since Apr 16Pushed 10y ago2 watchersCompare

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

READMEChangelogDependencies (2)Versions (5)Used By (0)

Paddy
=====

[](#paddy)

[![Build Status](https://camo.githubusercontent.com/fb056fd68961948923ebd412b667eea53845bd3c6dd62972f5a890699cc7d01e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f67616a75732f70616464792e7376673f7374796c653d666c6174)](https://travis-ci.org/gajus/paddy)[![Coverage Status](https://camo.githubusercontent.com/0c4fabfd32031a0263342c220d0d1eb061a56175682e8dcb875455df0d06a8cc/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6a656b796c6c2f6a656b796c6c2e7376673f7374796c653d666c6174)](https://coveralls.io/r/gajus/paddy?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/f998efa8fac53779d39b2d85b55e3db6880eaece1870974fe03619f6c601407f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67616a75732f70616464792e7376673f7374796c653d666c6174)](https://packagist.org/packages/gajus/paddy)

Messenger is used to carry (flash) messages between page requests using [session](http://www.php.net/manual/en/features.sessions.php).

```
/**
 * @param string $namespace Namespace is used if more than one application is using Messenger. Defaults to the SERVER_NAME or "default".
 */
$messenger = new \Gajus\Paddy\Messenger();

/**
 * @param string $message
 * @param string $namespace Message namespace (success, error or notice).
 * @return $this
 */
$messenger->send('Loaded to the Gunwales!');
```

Sending a Message
-----------------

[](#sending-a-message)

Message is sent using `send` method. The second parameter is used to put message under a namespace.

```
$messenger->send('There is more grog on the deck!', 'success');
```

Namespace values are limited to "error", "notice" and "success". Limit is imposed to avoid accidental (and hard to catch) typos. If you would like to change this behaviour, [raise an issue](https://github.com/gajus/skip/issues) including an example use case for an alternative or a variable namespace.

Getting Messages
----------------

[](#getting-messages)

To get all messages nested under the respective namespace, use `getMessages` method:

```
/**
 * Return all messages nested under the respective message namespace.
 *
 * @return array
 */
$messenger->getMessages();
```

To check if there are messages under a specific namespace, use `has` method:

```
/**
 * Check if there are messages under the specified message namespace.
 *
 * @param string $namespace
 * @return boolean
 */
$messenger->has('error');
```

### Message Holder

[](#message-holder)

Use the message holder when you intend to display messages to the end user:

```
$messenger->send('a');
$messenger->send('b', 'success');

echo $messenger->getMessageHolder();
```

```

    a
    b

```

When there are no messages, `getMessageHolder` will produce:

```

```

The empty tag is used for interoperability with the frontend script.

Proposed stylesheet:

```
.paddy-messenger {
    display: none;

    li {
        display: block; padding: 20px; color: #fff;

        &.error {
            background: #E74C3C;
        }

        &.notice {
            background: #F1C40F;
        }

        &.important {
            background: #3498DB;
        }

        &.success {
            background: #27AE60;
        }
    }

    &.with-messages {
        display: block;
    }
}
```

Shorthand
---------

[](#shorthand)

```
/**
 * Shorthand method to send message under "error" namespace.
 *
 * @param string $message
 * @return $this
 */
public function error ($message) {
    return $this->send($message, 'error');
}

/**
 * Shorthand method to send message under "success" namespace.
 *
 * @param string $message
 * @return $this
 */
public function success ($message) {
    return $this->send($message, 'success');
}

/**
 * Shorthand method to send message under "notice" namespace.
 *
 * @param string $message
 * @return $this
 */
public function notice ($message) {
    return $this->notice($message, 'notice');
}
```

Quasi-Persistency
-----------------

[](#quasi-persistency)

Messages are carried across pages using `$_SESSION` variable. This requires that you start session before using Paddy.

```
// Page 1
$messenger->error('foo');
```

Response that has "location" header continue to persist message data:

```
// Page 2
header('Location: Page 3');
```

Messages are discarded after the first page is displayed:

```
// Page 3
var_dump($messenger->has('error'));
```

```
array(1) {
  [0]=>
  bool(true)
}

```

Name
----

[](#name)

Named after pigeon number NPS.43.9451, [Paddy](http://en.wikipedia.org/wiki/Paddy_(pigeon)).

Logging
-------

[](#logging)

Implements [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) `LoggerAwareInterface`.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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.

###  Release Activity

Cadence

Every ~77 days

Total

4

Last Release

4180d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b46b18abe058b038c677a9fa4aa6c39de7597196fb72a11add1f11600412a0e5?d=identicon)[gajus](/maintainers/gajus)

---

Top Contributors

[![gajus](https://avatars.githubusercontent.com/u/973543?v=4)](https://github.com/gajus "gajus (58 commits)")

---

Tags

messageflash

### Embed Badge

![Health badge](/badges/gajus-paddy/health.svg)

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

###  Alternatives

[php-amqplib/php-amqplib

Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.

4.6k125.3M879](/packages/php-amqplib-php-amqplib)[aws/aws-php-sns-message-validator

Amazon SNS message validation for PHP

21421.5M91](/packages/aws-aws-php-sns-message-validator)

PHPackages © 2026

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