Download the PHP package anax/response without Composer
On this page you can find all versions of the php package anax/response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download anax/response
More information about anax/response
Files in anax/response
Package response
Short Description Anax Response module, to create a HTTP response.
License MIT
Homepage https://dbwebb.se/anax
Informations about the package response
Anax Response
Anax Response module to send HTTP responses.
The module is used to send a HTTP response from the Anax framework, including status code, headers, and body.
Table of content
- Class, interface, trait
- Exceptions
- Configuration file
- DI service
- General usage within the Anax framework
- Access as framework service
- Create, init and use an object
Class, interface, trait
The following classes, interfaces and traits exists.
Class, interface, trait | Description |
---|---|
Anax\Response\Response |
Wrapper class for response details and related. |
Anax\Response\ResponseUtility |
Extends the Request class to be injectable with $id to enable easy to use redirect methods. |
Exceptions
Module specific exceptions are thrown through Anax\Response\Exception
.
Configuration file
There is no configuration file for this module.
DI service
The module is created as a framework service within $di
. You can see the details in the configuration file config/di/response.php
.
It can look like this.
- The object is created as a shared resource.
- DI is injected into the module, when using ResponseUtility.
The service is lazy loaded and not created until it is used.
General usage within the Anax framework
The response service is a mandatory service within the Anax framework and it is the first service used when handling a request to the framework.
Here is the general flow for receiving a request, mapping it to a route and returning a response. This is found in the frontcontroller htdocs/index.php
of an Anax installation.
The request is used to get the request method and the route path, these are used by the router service to find a callback for the route. Each callback can then return a response which is sent through the response service.
Access as framework service
You can access the module as a framework service.
Create, init and use an object
This is how the object can be created. This is usually done within the framework as a sevice in $di
.
The added benefit of using ResponseUtility is that this class is injected with DI and makes it easier to use the redirect methods for urls within the framework.
License
This software carries a MIT license. See LICENSE.txt for details.