Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Laravel superglobals cheat sheet
$_SERVER['HTTP_HOST'] = Request::getHttpHost();
$_SERVER['HTTP_HOST'] = request()->getHttpHost();
// Alternative could be to use URL::previous(), but this will always return current URL if no referer is present.
// @see
$_SERVER['HTTP_REFERER'] = Request::header('referer', 'default');
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = Request::getPreferredLanguage();
$_SERVER['HTTP_USER_AGENT'] = Request::userAgent();
$_SERVER['REQUEST_URI'] = Request::getRequestUri();
$_SERVER['REQUEST_URI'] = request()->getRequestUri();
$_SERVER['SERVER_NAME'] = Request::server('SERVER_NAME');
$_GET['foo'] = Request::query('foo');
$_POST['foo'] = Request::input('foo');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment