mini\Http\Message\ServerRequest::getAttribute() Method

public

Signature

public function getAttribute($name, $default = NULL)

Parameters

Name Type Default Description
$name mixed required Documentation missing
$default mixed NULL Documentation missing

Documentation

Retrieve a single derived request attribute.

Retrieves a single derived request attribute as described in getAttributes(). If the attribute has not been previously set, returns the default value as provided.

This method obviates the need for a hasAttribute() method, as it allows specifying a default value to return if the attribute is not found.

Source

src/Http/Message/ServerRequestTrait.php:369-371