Zend framework 2 generating route url with domain name
Nothing more than this little line of code:
$homeUrl = $this->url( 'youRouteName', array(/* your route params */), array('force_canonical' => true) );
Of course, you need to call it within a code zone where you can invoke the URL helper. What you see above, assumes that you are in a .phtml file invoked by a controller’s action.