Skip to content

mckay-software/httpstatus.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HttpStatus.php

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

About

Easy HTTP statuses.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages