phphacks/zend-httperrors

Installs: 8 657

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/phphacks/zend-httperrors

v1.0.5 2020-09-25 19:07 UTC

This package is not auto-updated.

Last update: 2025-10-04 20:39:02 UTC


README

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.