Maybe it’s because I got my ZF start from Magento, but I’m enamoured with having a static class full of global helper methods.
For example:
/** * Get the user's real IP address through proxies * * @return string */ public static function getIpAddress() { // Gets the user's real IP address if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); return trim($ips[count($ips) - 1]); } elseif ( isset($_SERVER['HTTP_CLIENT_IP']) && !empty($_SERVER['HTTP_CLIENT_IP']) ) { return $_SERVER['HTTP_CLIENT_IP']; } return $_SERVER['REMOTE_ADDR']; }