coercive / headerstatus
Coercive HeaderStatus Utility
1.1.0
2026-10-20 07:43 UTC
Requires
- php: >=7.4
Requires (Dev)
- phpunit/phpunit: ^12
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-20 07:44:42 UTC
README
HeaderStatus lets you simply send HTTP response status.
Compatible PHP 7.4 → 8.5, no dependency.
Get
composer require coercive/headerstatus
Usage
use Coercive\Utility\HeaderStatus\HeaderStatus; # SEND - 200 Default Status HeaderStatus::send(); # SEND - Your Status : Example 301 HeaderStatus::send(301); # SEND - Force the status line with the reason phrase of the list (don't use php function "http_response_code") # Sends "HTTP/1.1 418 I'm a teapot" HeaderStatus::send(418, true); # A code outside 100 - 599 is ignored (the current status is kept) and send() returns false HeaderStatus::send(1000); // false # Reason phrase of a code (null if unknown) echo HeaderStatus::message(418); // I'm a teapot # The full list HeaderStatus::STATUS_CODES;
Tests
composer install
vendor/bin/phpunit
PHPUnit 12 requires PHP 8.3+ to run the tests ; the library itself still runs on PHP 7.4.
The http group starts the PHP built-in server on a free local port : vendor/bin/phpunit --exclude-group http to skip it.