Flash message management for kohana

Installs: 11 133

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0


v1.0.0 2019-04-03 14:31 UTC

This package is auto-updated.

Last update: 2020-08-03 17:35:49 UTC


License Master Build Status Latest Stable Version Total Downloads Latest Unstable Version

Pigeonhole is a simple flash messaging library for Kohana.


Add config to your composer.json and run composer update to install it. Note that we recommend forcing all kohana modules into your standard composer vendor directory. If you want to use the old-style MODPATH, then don't use the "extra" composer config option.

  "require": {"ingenerator/pigeonhole": "0.1.*@dev"},
  "extra":   {"installer-paths":{"vendor/{$vendor}/{$name}":["type:kohana-module"]}}

In your bootstrap, add it to your modules list:

        'pigeonhole' => BASEDIR.'vendor/ingenerator/pigeonhole' 
        // Or MODPATH.'pigeonhole' if using old-style kohana paths

Basic Usage

To set a simple string message:

class Controller_Something {
    public function action_message() {
        $message    = new \Ingenerator\Pigenohole\Message(
            'Look Out!', 
            'There\'s a monster behind you', 
        $pigeonhole = new \Ingenerator\Pigeonhole\Pigeonhole(Session::instance());

For the simplest way to render messages using Kohana's native view rendering:

/// views/template/global.php
  <link rel="stylesheet" 
        array('pigeonhole' => new \Ingenerator\Pigeonhole\Pigeonhole(Session::instance()))

Note that we actually recommend you use view models and manage the pigeonhole class and nested view outside the template. It's obviously easy to render the messages to support any CSS setup, we render for bootstrap by default.

Message types

In addition to simple string messages, we provide built-in handling for some additional common message types.

Validation messages

Formats the output of kohana validation errors with a given message file:

$validation = Validation::factory($post)->rule('email', 'not_empty');
$message = new \Ingenerator\Pigeonhole\Message\ValidationMessage(

Kohana messages

Looks up the title and message in a kohana messages file and replaces any provided parameters:

/// APPPATH/messages/actions.php
return array(
    'signed_in' => array(
      'title'   => 'Welcome',
      'message' => ':email, you are now logged in'

/// Controller
$message = new \Ingenerator\Pigeonhole\Message\KohanaMessage(
    array(':email' => $email), 

Testing and developing

pigeonhole has a suite of PhpSpec specifications. You'll need a skeleton Kohana application to run them, you can use koharness to create one. See travis.yml for the build steps required.

Contributions will only be accepted if they are accompanied by well structured specs. Installing with composer should get you everything you need to work on the project.


pigeonhole is copyright 2014 inGenerator Ltd and released under the BSD license.