kayex/http-codes
Composer 安装命令:
composer require kayex/http-codes
包简介
Small PHP library for easily accessing HTTP Status Codes.
README 文档
README
PHP library for easily accessing HTTP Status codes.
Table of Contents
Installation
Composer
composer require kayex/http-codes
Usage
The codes are accessible as public static properties on the HttpCodes class
use Kayex\HttpCodes; echo HttpCodes::HTTP_OK; // 200
Optional: Laravel alias
Laravel users may want to set up an alias for quick access by adding the following to the alias array in app/config/app.php:
'HttpCodes' => 'Kayex\HttpCodes',
The codes can then be used like this:
use HttpCodes; echo HttpCodes::HTTP_OK; // 200
Full reference
These are all the available status codes and the names they are accessible under.
1xx - Informational
| Property | Code |
|---|---|
HTTP_CONTINUE |
100 |
HTTP_SWITCHING_PROTOCOLS |
101 |
2xx - Successful
| Property | Code |
|---|---|
HTTP_OK |
200 |
HTTP_CREATED |
201 |
HTTP_ACCEPTED |
202 |
HTTP_NONAUTHORITATIVE_INFORMATION |
203 |
HTTP_NO_CONTENT |
204 |
HTTP_RESET_CONTENT |
205 |
HTTP_PARTIAL_CONTENT |
206 |
3xx - Redirect
| Property | Code |
|---|---|
HTTP_MULTIPLE_CHOICES |
300 |
HTTP_MOVED_PERMANENTLY |
301 |
HTTP_FOUND |
302 |
HTTP_SEE_OTHER |
303 |
HTTP_NOT_MODIFIED |
304 |
HTTP_USE_PROXY |
305 |
HTTP_UNUSED |
306 |
HTTP_TEMPORARY_REDIRECT |
307 |
4xx - Client Error
| Property | Code |
|---|---|
HTTP_BAD_REQUEST |
400 |
HTTP_UNAUTHORIZED |
401 |
HTTP_PAYMENT_REQUIRED |
402 |
HTTP_FORBIDDEN |
403 |
HTTP_NOT_FOUND |
404 |
HTTP_METHOD_NOT_ALLOWED |
405 |
HTTP_NOT_ACCEPTABLE |
406 |
HTTP_PROXY_AUTHENTICATION_REQUIRED |
407 |
HTTP_REQUEST_TIMEOUT |
408 |
HTTP_CONFLICT |
409 |
HTTP_GONE |
410 |
HTTP_LENGTH_REQUIRED |
411 |
HTTP_PRECONDITION_FAILED |
412 |
HTTP_REQUEST_ENTITY_TOO_LARGE |
413 |
HTTP_REQUEST_URI_TOO_LONG |
414 |
HTTP_UNSUPPORTED_MEDIA_TYPE |
415 |
HTTP_REQUESTED_RANGE_NOT_SATISFIABLE |
416 |
HTTP_EXPECTATION_FAILED |
417 |
5xx - Server Error
| Property | Code |
|---|---|
HTTP_INTERNAL_SERVER_ERROR |
500 |
HTTP_NOT_IMPLEMENTED |
501 |
HTTP_BAD_GATEWAY |
502 |
HTTP_SERVICE_UNAVAILABLE |
503 |
HTTP_GATEWAY_TIMEOUT |
504 |
HTTP_VERSION_NOT_SUPPORTED |
505 |
License
MIT
kayex/http-codes 适用场景与选型建议
kayex/http-codes 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 204.22k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2017 年 02 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「http」 「status code」 「http status」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kayex/http-codes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kayex/http-codes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kayex/http-codes 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Serves functionality of healthchecks of your application
repository php library
Doctrine implementation of the MetaborStd (Statemachine) for PHP 8.2+
404 'not found' and 403 'forbidden' error handlers. The 404 handler shows custom content for missing pages but not resources like CSS or JS. The 403 handler redirects to a login URL on unauthorized access.
Provide status and health api endpoints
统计信息
- 总下载量: 204.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 23
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-14