HTTP Foundation
Backyard uses the Symfony HTTP Foundation package when working with HTTP requests. The package, defines an object-oriented layer for the HTTP specification.
For more information about the package, please refer to the official documentation.
The request factory
Backyard provides a helpful factory class that takes care of capturing the request from global variables ( $_POST, etc. ). Global variables are cleaned up with stripslashes_deep
and then the final layer is created.
To capture the request use the create
method:
use Backyard\Utils\RequestFactory;
$request = RequestFactory::create();
The create
method returns a configured instance of Symfony\Component\HttpFoundation\Request
.