Oihana PHP

ParamsStrategyTrait

Provides a property to retrieve params in the Http request parameters or body.

The strategy controls where a controller reads request parameters from: the query string, the request body, or both.

Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Constants

PARAMS_STRATEGY  : string = 'paramsStrategy'
The 'paramsStrategy' parameter.

Properties

$paramsStrategy  : string
Strategy to fetch parameters: 'both' (default), 'body' only, or 'query' only.

Methods

initializeParamsStrategy()  : static
Initialize the params strategy : 'both' (default), 'body' (only), 'query' (only).

Constants

PARAMS_STRATEGY

The 'paramsStrategy' parameter.

public string PARAMS_STRATEGY = 'paramsStrategy'

Properties

$paramsStrategy

Strategy to fetch parameters: 'both' (default), 'body' only, or 'query' only.

public string $paramsStrategy = \oihana\enums\http\HttpParamStrategy::BOTH

Methods

initializeParamsStrategy()

Initialize the params strategy : 'both' (default), 'body' (only), 'query' (only).

public initializeParamsStrategy([string|array<string|int, mixed>|null $strategy = null ]) : static
Parameters
$strategy : string|array<string|int, mixed>|null = null

Either a string strategy or an array carrying it under the self::PARAMS_STRATEGY key. Invalid values are ignored and the current strategy is kept.

Return values
static

Returns the current instance for method chaining.

On this page

Search results