The aim of the HeaderManager is to send HTTP headers to the client. Beyond this, the class guarantees, that URLs generated with the LinkGenerator can be used as well.
The following static methods are available for use by the developer:
The following code box shows a typical examples:
use APF\tools\http\HeaderManager; use APF\tools\link\LinkGenerator; use APF\tools\link\Url; $link = LinkGenerator::generateUrl( Url::fromCurrent()->mergeQuery(array('param1' => '','param2' => 'new_value')) ); HeaderManager::forward($link);
Both methods forward() and redirect() abort further code execution using exit() to avoid code injection (see Overview of Execution After Redirect Web Application Vulnerabilities).
To switch off the default behaviour you may want to use HeaderManager's deactivateExitAfterForward() or activateExitAfterForward() methods to either globally switch this feature off or on.
To deactivate abortion with a dedicated forward() or redirect() call you can apply the optional $exitAfterForward parameter set to false.