Documentation

QueryDefaultsPlugin
in package
implements Plugin

FinalYes

Set query to default value if it does not exist.

If a given query parameter already exists the value wont be replaced and the request wont be changed.

Tags
author

Tobias Nyholm tobias.nyholm@gmail.com

Table of Contents

Interfaces

Plugin
A plugin is a middleware to transform the request and/or the response.

Properties

$queryParams  : array<string|int, mixed>

Methods

__construct()  : mixed
handleRequest()  : Promise
Handle the request and return the response coming from the next callable.

Properties

Methods

__construct()

public __construct(array<string|int, mixed> $queryParams) : mixed
Parameters
$queryParams : array<string|int, mixed>

Hashmap of query name to query value. Names and values must not be url encoded as this plugin will encode them

handleRequest()

Handle the request and return the response coming from the next callable.

public handleRequest(RequestInterface $request, callable $next, callable $first) : Promise
Parameters
$request : RequestInterface
$next : callable

Next middleware in the chain, the request is passed as the first argument

$first : callable

First middleware in the chain, used to to restart a request

Return values
Promise

Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient)


        
On this page

Search results