Download the PHP package stadly/http without Composer
On this page you can find all versions of the php package stadly/http. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package http
Short Description A PHP library for handling HTTP headers.
License MIT
Homepage https://github.com/Stadly/Http
Informations about the package http
Http
A PHP library for parsing and building HTTP headers.
Install
Via Composer
Usage
Parsing HTTP headers
Header values can be parsed using fromValue
on each header class:
Header strings can be parsed using HeaderFactory::fromString
:
Note that header strings include the header name, while header values do not. The following results in identical headers:
Example usage
Example parsing the If-None-Match
request header and using it to determine whether to serve a file. The response headers Content-Disposition
and ETag
are built for serving the file.
Header fields overview
The checked header fields have been implemented.
Common header fields
Representation Metadata
- [x] Content-Type https://tools.ietf.org/html/rfc7231#section-3.1.1.5
- [ ] Content-Encoding https://tools.ietf.org/html/rfc7231#section-3.1.2.2
- [ ] Content-Language https://tools.ietf.org/html/rfc7231#section-3.1.3.2
- [ ] Content-Location https://tools.ietf.org/html/rfc7231#section-3.1.4.2
Payload Semantics
- [ ] Content-Length https://tools.ietf.org/html/rfc7230#section-3.3.2
- [ ] Content-Range https://tools.ietf.org/html/rfc7233#section-4.2
- [ ] Trailer https://tools.ietf.org/html/rfc7230#section-4.4
- [ ] Transfer-Encoding https://tools.ietf.org/html/rfc7230#section-3.3.1
Request header fields
Controls
- [ ] Cache-Control https://tools.ietf.org/html/rfc7234#section-5.2
- [ ] Expect https://tools.ietf.org/html/rfc7231#section-5.1.1
- [ ] Host https://tools.ietf.org/html/rfc7230#section-5.4
- [ ] Max-Forwards https://tools.ietf.org/html/rfc7231#section-5.1.2
- [ ] Pragma https://tools.ietf.org/html/rfc7234#section-5.4
- [x] Range https://tools.ietf.org/html/rfc7233#section-3.1
- [ ] TE https://tools.ietf.org/html/rfc7230#section-4.3
Conditionals
- [x] If-Match https://tools.ietf.org/html/rfc7232#section-3.1
- [x] If-None-Match https://tools.ietf.org/html/rfc7232#section-3.2
- [x] If-Modified-Since https://tools.ietf.org/html/rfc7232#section-3.3
- [x] If-Unmodified-Since https://tools.ietf.org/html/rfc7232#section-3.4
- [x] If-Range https://tools.ietf.org/html/rfc7233#section-3.2
Content Negotiation
- [ ] Accept https://tools.ietf.org/html/rfc7231#section-5.3.2
- [ ] Accept-Charset https://tools.ietf.org/html/rfc7231#section-5.3.3
- [ ] Accept-Encoding https://tools.ietf.org/html/rfc7231#section-5.3.4
- [ ] Accept-Language https://tools.ietf.org/html/rfc7231#section-5.3.5
Authentication Credentials
- [ ] Authorization https://tools.ietf.org/html/rfc7235#section-4.2
- [ ] Proxy-Authorization https://tools.ietf.org/html/rfc7235#section-4.4
Request Context
- [ ] From https://tools.ietf.org/html/rfc7231#section-5.5.1
- [ ] Referer https://tools.ietf.org/html/rfc7231#section-5.5.2
- [ ] User-Agent https://tools.ietf.org/html/rfc7231#section-5.5.3
Response header fields
Control Data
- [ ] Age https://tools.ietf.org/html/rfc7234#section-5.1
- [x] Cache-Control https://tools.ietf.org/html/rfc7234#section-5.2
- [ ] Expires https://tools.ietf.org/html/rfc7234#section-5.3
- [ ] Date https://tools.ietf.org/html/rfc7231#section-7.1.1.2
- [ ] Location https://tools.ietf.org/html/rfc7231#section-7.1.2
- [ ] Retry-After https://tools.ietf.org/html/rfc7231#section-7.1.3
- [ ] Vary https://tools.ietf.org/html/rfc7231#section-7.1.4
- [ ] Warning https://tools.ietf.org/html/rfc7234#section-5.5
Validator Header Fields
- [x] ETag https://tools.ietf.org/html/rfc7232#section-2.3
- [ ] Last-Modified https://tools.ietf.org/html/rfc7232#section-2.2
Authentication Challenges
- [ ] WWW-Authenticate https://tools.ietf.org/html/rfc7235#section-4.1
- [ ] Proxy-Authenticate https://tools.ietf.org/html/rfc7235#section-4.3
Response Context
- [ ] Accept-Ranges https://tools.ietf.org/html/rfc7233#section-2.3
- [ ] Allow https://tools.ietf.org/html/rfc7231#section-7.4.1
- [ ] Server https://tools.ietf.org/html/rfc7231#section-7.4.2
Other
- [x] Content-Disposition https://tools.ietf.org/html/rfc6266#section-4
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Contributing
Please see CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Magnar Ovedal Myrtveit
- All Contributors
License
The MIT License (MIT). Please see License File for more information.