Request

Routing can be very helpful. But sometimes you will need the full request data. The object $app->request provides you the necessary data. Here is the information you receive for this example URL:
http://example.com/products/iphone/?order=asc&count=5

use BearFramework\App;

$app App::get();

$app->request->method// GET
$app->request->scheme// http
$app->request->host// example.com
$app->request->base// http://example.com
(string) $app->request->path// /products/iphone/
$app->request->path->getSegment(0); // products
$app->request->path->getSegment(1); // iphone
$app->request->path->getSegment(2); // null
(string) $app->request->query// ?order=asc&count=5
$app->request->query->getValue('order'); // asc
$app->request->query->getValue('count'); // 5
$app->request->query->getValue('missing'); // null
$app->request->getURL(); // http://example.com/products/iphone/?order=asc&count=5

Learn more

Handle HTTP requests
Store and retrieve data
Store frequently used data for later usage

The information on this page is created for version 1.1 of Bear Framework and may not be applicable for other versions of the framework.