Appearance
Radiate\Http\Request
Implements
Properties
$request
The request attributes
php
protected array $request$cookies
The cookie attributes
php
protected array $cookies$files
The file attributes
php
protected array $files$server
The server attributes
php
protected array $server$headers
The header attributes
php
protected array $headers$userResolver
The user resolver
php
protected \Closure $userResolverMethods
__construct
Create the request instance
php
public function __construct(array $request = [], array $cookies = [], array $files = [], array $server = []): voidProperties
$requestUsually the global$_REQUESTarray$cookiesUsually the global$_COOKIEarray$filesUsually the global$_FILESarray$serverUsually the global$_SERVERarray
capture
Capture the global request
php
public static function capture(): RequestcreateFrom
Create a new request from this one
php
public static function createFrom(self $from, ?Request $to = null): RequestProperties
$fromThe request to create from$toThe request to create to
server
Get a server attribute
php
public function server(string $key, mixed $default = null): mixedProperties
$keyThe key of the server entry to return$defaultThe fallback if the entry doesn't exist
header
Get a header
php
public function header(string $key, mixed $default = null): mixedProperties
$keyThe key of the header to return$defaultThe fallback if the header doesn't exist
isMethod
Determine if the method matches the given method
php
public function isMethod(string $method): boolProperties
$methodThe method to check against
method
Get the intended method
php
public function method(): stringrealMethod
Get the real request method
php
public function realMethod(): stringmerge
Merge the attributes into the request
php
public function merge(array $attributes): selfProperties
$attributesThe attributes to merge into the request
ajax
Determine if the request was made with AJAX
php
public function ajax(): boolwantsJson
Determine if the request can accept a JSON response
php
public function wantsJson(): boolexpectsJson
Determine if the request expects a JSON response
php
public function expectsJson(): boolhas
Determine if the attribute exists
php
public function has(string $key): boolProperties
$keyThe key to check on the request
get
Get an attribute or fallback
php
public function get(string $key, $default = null): mixedProperties
$keyThe key to get$keyThe fallback if the entry doesn't exist
add
Add an attribute to the request
php
public function add(string $key, mixed $value): voidProperties
$keyThe key to add$valueThe value to set in the request
remove
Remove the attribute from the request
php
public function remove(string $key): voidProperties
$keyThe key to remove
user
Get the request user
See the AuthManager class for more information
php
public function user(): \WP_User|falsesetUserResolver
Set the user resolver
php
public function setUserResolver(\Closure $resolver): selfProperties
$resolverThe user resolver
getUserResolver
Set the user resolver
php
public function getUserResolver(): \Closureall
Return the object as an array
php
public function all(): arraytoArray
Return the object as an array
php
public function toArray(): arraytoJson
Return the object as a json string
php
public function toJson(): string__toString
Return the object as a json string
php
public function __toString(): string__isset
Determine if the attribute exists
php
public function __isset(string $key): boolProperties
$keyThe key to check on the request
__get
Get an attribute
php
public function __get(string $key): mixedProperties
$keyThe key to get
__set
Add an attribute to the request
php
public function __set(string $key, mixed $value): voidProperties
$keyThe key to set$valueThe value to set