__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');
string
the uri string
bool
whether or not to route the URI
string
request method
\FuelException |
---|
__toString() : string
Usage:
$request = Request::forge('hello/world')->execute();
echo $request;
string
the responseactive(\Fuel\Core\Request | null | false $request) : \Fuel\Core\Request
Usage:
Request::active();
\Fuel\Core\Request
null
false
overwrite current request before returning, false prevents overwrite
add_path(string $path, bool $prefix) : void
string
the new path
bool
whether to add to the front or the back of the array
children() : array
array
execute(array | null $method_params) : \Fuel\Core\Request
Usage:
$request = Request::forge('hello/world')->execute();
array
null
An array of parameters to pass to the method being executed
\Exception |
|
---|---|
\FuelException |
|
\HttpNotFoundException |
\Fuel\Core\Request
This 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');
string
The URI of the request
mixed
Internal: whether to use the routes; external: driver type or array with settings (driver key must be set)
string
request method
\Fuel\Core\Request
The new request objectget_method() : string
string
request methodget_paths() : array
array
the array of pathsis_hmvc() : bool
Usage:
if (Request::is_hmvc())
{
// Do something special...
return;
}
bool
main() : \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
string
Name of the parameter
mixed
Default value
mixed
params() : array
array
reset_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\Response
This Request's Response objectset_method(string $method) : object
string
request method
object
current instance$action : string
$controller : string
$directory : string
$method_params : array
$module : string
$named_params : array
$paths : array
$children : array
$method : string