mckay / httpstatus
Easy HTTP statuses.
Installs: 5 666
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 9
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-04-26 20:40:06 UTC
README
Class constants for HTTP statuses.
Install
Add it to your composer.json:
"mckay/httpstatus": "^1.0.4",
then run $ composer update
.
Usage
use \McKay\HttpStatus; if (!$user->isRoot()) { renderView(...); HttpStatus::set(HttpStatus::UNAUTHORIZED); return; } if (empty($resource)) { renderError(...); HttpStatus::set(HttpStatus::NOT_FOUND); return; } function renderError(...) { $code = HttpStatus::get(); $description = HttpStatus::text(); ... }
See the source for the complete list of available HTTP status constants.
License
Copyright © McKay Software
MIT License
http://mckay.mit-license.org