__construct()
__toString()
active()
add_path()
children()
execute()
forge()
get_method()
get_paths()
input()
is_hmvc()
main()
param()
params()
parent()
reset_request()
response()
set_delete()
set_get()
set_json()
set_method()
set_patch()
set_post()
set_put()
$action
$controller
$controller_instance
$directory
$method_params
$module
$named_params
$paths
$response
$route
$uri
$active
$children
$input
$main
$method
$parent
The Request class is used to create and manage new and existing requests.
There is a main request which comes in from the browser or command line, then new requests can be created for HMVC requests.
Example Usage:
$request = Request::forge('foo/bar')->execute();
echo $request->response();
| package | Fuel |
|---|---|
| subpackage | Core |
__construct(string $uri, bool $route, string $method)
Usage:
$request = new Request('foo/bar');
stringthe uri string
boolwhether or not to route the URI
stringrequest method
\FuelException |
|---|
__toString() : string
Usage:
$request = Request::forge('hello/world')->execute();
echo $request;
stringthe responseactive(\Fuel\Core\Request | null | false $request) : \Fuel\Core\Request
Usage:
Request::active();
\Fuel\Core\Requestnullfalseoverwrite current request before returning, false prevents overwrite
add_path(string $path, bool $prefix) : void
stringthe new path
boolwhether to add to the front or the back of the array
children() : array
arrayexecute(array | null $method_params) : \Fuel\Core\Request
Usage:
$request = Request::forge('hello/world')->execute();
arraynullAn array of parameters to pass to the method being executed
\Exception |
|
|---|---|
\FuelException |
|
\HttpNotFoundException |
\Fuel\Core\RequestThis request objectforge(string $uri, mixed $options, string $method) : \Fuel\Core\Request
The request is then set to be the active request. If this is the first request, then save that as the main request for the app.
Usage:
Request::forge('hello/world');
stringThe URI of the request
mixedInternal: whether to use the routes; external: driver type or array with settings (driver key must be set)
stringrequest method
\Fuel\Core\RequestThe new request objectget_method() : string
stringrequest methodget_paths() : array
arraythe array of pathsis_hmvc() : bool
Usage:
if (Request::is_hmvc())
{
// Do something special...
return;
}
boolmain() : \Fuel\Core\Request
This is the first executed Request, not necessarily the root parent of the current request.
Usage:
Request::main();
param(string $param, mixed $default) : mixed
stringName of the parameter
mixedDefault value
mixedparams() : array
arrayreset_request($full) : void
This is needed after the active request is finished.
Usage:
Request::reset_request();
response() : \Fuel\Core\Response
Usage:
$response = Request::forge('foo/bar')->execute()->response();
\Fuel\Core\ResponseThis Request's Response objectset_method(string $method) : object
stringrequest method
objectcurrent instance$action : string
$controller : string
$directory : string
$method_params : array
$module : string
$named_params : array
$paths : array
$children : array
$method : string