mckay / httpstatus
Easy HTTP statuses.
v1.0.6
2015-05-07 23:28 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2026-03-15 01:11:45 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