icanboogie / http
Provides an API to handle HTTP requests.
6.0
2025-01-12 00:39 UTC
Requires
- php: >=8.2
- ext-mbstring: *
- icanboogie/accessor: ^6.0
- icanboogie/event: ^6.0
Requires (Dev)
- ext-fileinfo: *
- ext-gd: *
- icanboogie/datetime: ^3.0
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The icanboogie/http package provides a foundation to handle HTTP requests, with representations for requests, request files, responses, and headers.
The following example is an overview of request processing:
<?php namespace ICanBoogie\HTTP; // The request is usually created from the $_SERVER super global. $request = Request::from_server(); /* @var ResponderProvider $responder_provider */ // The Responder Provider matches a request with a Responder $responder = $responder_provider->responder_for_request($request); // The Responder responds to the request with a Response, it might also throw an exception. $response = $responder->respond($request); // The response is sent to the client. (new SimpleResponseSender())->send($response->finalize($request)); # or $response($request); // request is only necessary in file responses
Installation
composer require icanboogie/http
Documentation
- Request: request creation, parameters, files, and context.
- Response: response status, streaming, redirects, and file delivery.
- Headers: header fields manipulation.
- Responders: responders and their decorators.
- Exceptions: HTTP-related exceptions.
Continuous Integration
The project is continuously tested by GitHub actions.
Code of Conduct
This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.
Contributing
See CONTRIBUTING for details.
License
icanboogie/http is released under the BSD-3-Clause.