Skip to content

Http compliant error reporting structure for zend framework.

License

Notifications You must be signed in to change notification settings

phphacks/zend-httperrors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zend-httperrors

Http compliant error reporting structure for zend framework.

composer require phphacks/zend-httperrors

Add to your modules.config.php

return [
  'Zend\HttpErrors',
  'My\Other\Modules'
];

Then throw an HttpErrorException

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.