Create custom controller plugin/helper zf2.

In this example we will get the country list in country table.

We will name our plugin/helper CommonData.

/**
 * CommonData Helper for application module.
 * @author Resourcemode <resourcemode@yahoo.com>
 */

namespace Application\Controller\Plugin;

use Zend\Mvc\Controller\Plugin\AbstractPlugin;
use Application\Model\CountryTable;

class CommonData extends AbstractPlugin
{    
    /**
     * Helper to display country in array;
     * @uses Country Table
     * @return $array
     */
    public function getCountry()
    {
        $countryTable = new CountryTable();
        $countryList = $countryTable->fetchAll();

        $country = array();
        foreach ($countryList as $list) {
            $country[$list->getId()] = $list->getName();
        }      
        return $country;
    }
?>

We need to register the plugin/helper in our Application module(module.config.php)

<?php
    'controller_plugins' => array(
        'invokables' => array(
            'CommonData' => 'Application\Controller\Plugin\CommonData',
        ),
    ),
?>

To call or access the plugin/helper in controller.

<?php
    public function indexAction()
    {
        $countryList = $this->CommonData()->getCountry();
        echo $countryList;
    }
?>

Done!