HTTP Requests

Accessing the Request Instance

To access the current Request object you can inject it into your Controller by using the Rareloop\Lumberjack\Http\ServerRequest type hint, e.g.

use Rareloop\Lumberjack\Http\ServerRequest;

class MyController
{
    public function show(ServerRequest $request)
    {

    }
}

You can also use the request() helper to access the request from anywhere in your theme:

use Rareloop\Lumberjack\Helpers;

$request = Helpers::request();

// Or if you have global helpers enabled:
$request = request();

Usage

Get the method

Get the path

Get the URL

Get all query params

Get a specific query param

Get all post params

Get a specific post param

Get all input params

Get a specific input param

Does the request have a specific input key?

Last updated