Zend Framework 2/3 Refresh Redirect Module

I was inspired to write this simple module after using ZF flashMessanger controller plugin and view helper. The problem I found is when using the view helper the messages in flashMessanger are deleted, this means that if the user refreshes the page all messages are gone. This can possibly lead to errors depending on your code. To overcome this issue I wrote the refresh redirect module, this simply checks if the same page is called a second time, if so redirect to a different page.


With composer
  1. Add this project in your composer.json.
    For ZF2:
    "require": {
        "krytenuk/refresh-redirect": "1.0.*"

    For ZF3:
    "require": {
        "krytenuk/refresh-redirect": "2.0.*"
  2. Now tell composer to download FwsRefreshRedirect by running the command:
    $ php composer.phar update
Post installation
  1. Enabling it in your `application.config.php` or `modules.config.php` file.
    For ZF2 edit your `application.config.php` file.
    return array(
    'modules' => array(
    // ...
    // ...

    For ZF3 edit your `modules.config.php` file.
    return [
    // ...


Refresh Redirect is a controller plugin, when added to your controller actions, a page refresh will redirect to the specified route or url.

Redirect to route

To redirect to a route use: <?php
$params = array(); // your route params (optional)
$options = array(); // your route options (optional)
$reuseMatchedParams FALSE// reuse matched parameters (optional)
// or use

Redirect to url

To redirect to a url use: <?php

See Zend Framework redirect plugin for more info on the redirect parameters.