App::hasPathParam

Usage

bool App::hasPathParam(string $key)

Description

Checks whether or not the key exists within the dynamic path parameters.

Parameters

Parameter Required Type Description
$key Yes string The name of the variable to check whether or not it exists in the request.

Return Value

Boolean whether or not the variable exists within the dynamic path parameters.

Examples

Check whether or not variable exists in request.



if (!$app->hasPathParam('product_id')) { throw new Exception("No product ID specified."); }

See Also