folded / http
HTTP utilities for your web app.
0.1.2
2020-09-13 18:55 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-12-29 06:21:52 UTC
README
HTTP utilities for your web app.
Summary
- Installation
- Requirements
- API
- Information response
- Success
- Redirection
- Error
- Bad request
- Unauthorized
- Payment required
- Forbidden
- Not found
- Method not allowed
- Not acceptable
- Proxy authentication required
- Request timeout
- Conflict
- Gone
- Length required
- Precondition failed
- Payload too large
- URI too long
- Unsupported media type
- Range not satisfiable
- Expectation failed
- I'm a teapot
- Misdirected request
- Unprocessable entity
- Locked
- Failed dependency
- Too early
- Upgrade required
- Precondition required
- Too many requests
- Request header fields too large
- Unavailable for legal reasons
- Server error
- Changelog
- Contributing
- License
Requirements
Installation
$ composer require folded/http
API
Information response
Continue
<?php use Http\Information; echo Information::CONTINUE; // 100
Switching protocols
<?php use Http\Information; echo Information::SWITCHING_PROTOCOLS; // 101
Processing
<?php use Http\Information; echo Information::PROCESSING; // 102
Early hints
<?php use Http\Information; echo Information::EARLY_HINTS; // 103
Success
<?php use Http\Success; echo Success::OK; // 200
Created
<?php use Http\Success; echo Success::CREATED; // 201
Accepted
<?php use Http\Success; echo Success::ACCEPTED; // 202
Non-authoritative information
<?php use Http\Success; echo Success::NON_AUTHORITATIVE_INFORMATION; // 203
No content
<?php use Http\Success; echo Success::NO_CONTENT; // 204
Reset content
<?php use Http\Success; echo Success::RESET_CONTENT; // 205
Partial content
<?php use Http\Success; echo Success::PARTIAL_CONTENT; // 206
Multi-status
<?php use Http\Success; echo Success::MULTI_STATUS; // 207
Already reported
<?php use Http\Success; echo Success::ALREADY_REPORTED; // 208
Instance-manipulations used
<?php use Http\Success; echo Success::IM_USED; // 226
Redirection
Multiple choices
<?php use Http\Redirection; echo Redirection::MULTIPLE_CHOICES; // 300
Moved permanently
<?php use Http\Redirection; echo Redirection::MOVED_PERMANENTLY; // 301
Found (moved temporarily)
<?php use Http\Redirection; echo Redirection::FOUND; // 302 echo Redirection::MOVED_TEMPORARILY; // 302
See other
<?php use Http\Redirection; echo Redirection::SEE_OTHER; // 303
Not modified
<?php use Http\Redirection; echo Redirection::NOT_MODIFIED; // 304
Use proxy
<?php use Http\Redirection; echo Redirection::USE_PROXY; // 305
Switch proxy
<?php use Http\Redirection; echo Redirection::SWITCH_PROXY; // 306
Temporary redirect
<?php use Http\Redirection; echo Redirection::TEMPORARY_REDIRECT; // 307
Permanent redirect
<?php use Http\Redirection; echo Redirection::PERMANENT_REDIRECT; // 308
Error
Bad request
<?php use Http\Error; echo Error::BAD_REQUEST; // 400
Unauthorized
<?php use Http\Error; echo Error::UNAUTHORIZED; // 401
Payment required
<?php use Http\Error; echo Error::PAYMENT_REQUIRED; // 402
Forbidden
<?php use Http\Error; echo Error::FORBIDDEN; // 403
Not found
<?php use Http\Error; echo Error::NOT_FOUND; // 404
Method not allowed
<?php use Http\Error; echo Error::METHOD_NOT_ALLOWED; // 405
Not acceptable
<?php use Http\Error; echo Error::NOT_ACCEPTABLE; // 406
Proxy authentication required
<?php use Http\Error; echo Error::PROXY_AUTHENTICATION_REQUIRED; // 407
Request timeout
<?php use Http\Error; echo Error::REQUEST_TIMEOUT; // 408
Conflict
<?php use Http\Error; echo Error::CONFLICT; // 409
Gone
<?php use Http\Error; echo Error::GONE; // 410
Length required
<?php use Http\Error; echo Error::LENGTH_REQUIRED; // 411
Precondition failed
<?php use Http\Error; echo Error::PRECONDITION_FAILED; // 412
Payload too large
<?php use Http\Error; echo Error::PAYLOAD_TOO_LARGE; // 413
URI too long
<?php use Http\Error; echo Error::URI_TOO_LONG; // 414
Unsupported media type
<?php use Http\Error; echo Error::UNSUPPORTED_MEDIA_TYPE; // 415
Range not satisfiable
<?php use Http\Error; echo Error::RANGE_NOT_SATISFIABLE; // 416
Expectation failed
<?php use Http\Error; echo Error::EXPECTATION_FAILED; // 417
I'm a teapot
<?php use Http\Error; echo Error::IM_A_TEAPOT; // 418
Misdirected request
<?php use Http\Error; echo Error::MISDIRECTED_REQUEST; // 419
Unprocessable entity
<?php use Http\Error; echo Error::UNPROCESSABLE_ENTITY; // 422
Locked
<?php use Http\Error; echo Error::LOCKED; // 423
Failed dependency
<?php use Http\Error; echo Error::FAILED_DEPENDENCY; // 424
Too early
<?php use Http\Error; echo Error::TOO_EARLY; // 425
Upgrade required
<?php use Http\Error; echo Error::UPGRADE_REQUIRED; // 426
Precondition required
<?php use Http\Error; echo Error::PRECONDITION_REQUIRED; // 428
Too many requests
<?php use Http\Error; echo Error::TOO_MANY_REQUESTS; // 429
Request header fields too large
<?php use Http\Error; echo Error::REQUEST_HEADER_FIELDS_TOO_LARGE; // 431
Unavailable for legal reasons
<?php use Http\Error; echo Error::UNAVAILABLE_FOR_LEGAL_REASONS; // 451
Server error
Internal server error
<?php use Http\ServerError; echo ServerError::INTERNAL_SERVER_ERROR; // 500
Not implemented
<?php use Http\ServerError; echo ServerError::NOT_IMPLEMENTED; // 501
Bad gateway
<?php use Http\ServerError; echo ServerError::BAD_GATEWAY; // 502
Service unavailable
<?php use Http\ServerError; echo ServerError::SERVICE_UNAVAILABLE; // 503
Gateway timeout
<?php use Http\ServerError; echo ServerError::GATEWAY_TIMEOUT; // 504
Http version not supported
<?php use Http\ServerError; echo ServerError::HTTP_VERSION_NOT_SUPPORTED; // 505
Variant also negotiates
<?php use Http\ServerError; echo ServerError::VARIANT_ALSO_NEGOTIATES; // 506
Insufficient storage
<?php use Http\ServerError; echo ServerError::INSUFFICIENT_STORAGE; // 507
Loop detected
<?php use Http\ServerError; echo ServerError::LOOP_DETECTED; // 508
Not extended
<?php use Http\ServerError; echo ServerError::NOT_EXTENDED; // 510
Network authentication required
<?php use Http\ServerError; echo ServerError::NETWORK_AUTHENTICATION_REQUIRED; // 511
Changelog
See CHANGELOG.md
.
Contributing
See CONTRIBUTING.md
.
License
See LICENSE
.