akashjoshi1999/http-status-code
最新稳定版本:v1.0
Composer 安装命令:
composer require akashjoshi1999/http-status-code
包简介
HTTP status code constants and helpers for PHP (Composer package)
README 文档
README
This lightweight PHP package provides named constants and helper methods for HTTP status codes so developers can use meaningful constant names instead of raw integers.
Installation
Add to your project using Composer (once published):
composer require akashjoshi1999/http-status-code
Or include locally via composer.json PSR-4 autoload.
Usage
use HttpStatusCode\HttpStatus; // Use named constant instead of literal number $status = HttpStatus::OK; // 200 // Get reason phrase $phrase = HttpStatus::reasonPhrase($status); // 'OK' // Get constant name from code $name = HttpStatus::constantName(404); // 'NOT_FOUND' // List all codes $all = HttpStatus::all();
Files
src/HttpStatus.php— constants and helpersexamples/example.php— small usage example
Contributing
Contributions welcome. Add more codes or helper utilities as needed.
Running tests
Run the project's tests locally (after cloning/installing dependencies):
composer install composer test # or directly with PHPUnit: php vendor/bin/phpunit --configuration phpunit.xml
Expected output (example):
OK (4 tests, 12 assertions)
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-25