Download the PHP package effectra/http-server-handler without Composer
On this page you can find all versions of the php package effectra/http-server-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download effectra/http-server-handler
More information about effectra/http-server-handler
Files in effectra/http-server-handler
Package http-server-handler
Short Description The Effectra HTTP Server Handler package.
License MIT
Informations about the package http-server-handler
Effectra RequestHandler
The RequestHandler class is designed to handle HTTP requests by processing a stack of middlewares. It implements the RequestHandlerInterface to ensure compatibility with standardized request handling protocols.
Installation
You can install the RequestHandler class using Composer. Run the following command:
Usage
To use the RequestHandler, follow these steps:
-
Create an instance of the
RequestHandlerclass, providing aResponseInterfaceobject and an optional array of middlewares as parameters in the constructor. -
Call the
handlemethod of theRequestHandlerclass, passing aServerRequestInterfaceobject representing the incoming request. - The
handlemethod will process the middlewares stack, executing each middleware in the order they were added. It will return aResponseInterfaceobject representing the response generated by the middlewares.
Additional Methods
getLastRequest
The RequestHandler class provides a convenient method, getLastRequest, to retrieve the last processed request. It returns a ServerRequestInterface|null object representing the last request or null if no request has been processed.
Contributing
Contributions are welcome! If you would like to contribute to the development of the RequestHandler class, please follow these steps:
- Fork the repository and clone it locally.
- Create a new branch for your changes.
- Make your modifications and additions.
- Write tests to ensure the functionality of the class.
- Commit your changes and push them to your fork.
- Submit a pull request detailing your changes.
License
This project is licensed under the MIT License.