PHP code example of ingenerator / pigeonhole

1. Go to this page and download the library: Download ingenerator/pigeonhole library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ingenerator / pigeonhole example snippets


    Kohana::modules(array(
        'pigeonhole' => BASEDIR.'vendor/ingenerator/pigeonhole' 
        // Or MODPATH.'pigeonhole' if using old-style kohana paths
    );

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

/// views/template/global.php
<html>
<head>
  <link rel="stylesheet" 
        href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
    <?=View::factory(
        'pigeonhole/messages', 
        array('pigeonhole' => new \Ingenerator\Pigeonhole\Pigeonhole(Session::instance()))
    )->render();

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

/// 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(
    'actions', 
    'signed_in', 
    array(':email' => $email), 
    \Ingenerator\Pigeonhole\Message::SUCCESS
);