Http compliant error reporting structure for zend framework.
composer require phphacks/zend-httperrors
return [
'Zend\HttpErrors',
'My\Other\Modules'
];
class MyController
{
private $auth;
public function __construct(AuthorizationService $auth)
{
$this->auth = $auth;
}
public function doSomethingAction()
{
if(!$auth->isAuthorized()) {
throw new HttpUnauthorizedException();
}
}
}
That's just it.