Skip to content

Instantly share code, notes, and snippets.

@COil
Last active March 5, 2017 23:47
Show Gist options
  • Save COil/4b6c1b2513e89996f7511b2789a1c9c6 to your computer and use it in GitHub Desktop.
Save COil/4b6c1b2513e89996f7511b2789a1c9c6 to your computer and use it in GitHub Desktop.
Request class functions
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class AppController extends Controller
{
/**
* @Route("/my-route", name="blog_test")
*/
public function blogTestAction(Request $r)
{
// http://col.com/app_dev.php/my-route?bar=1&foo=bar#fragment
$infos["get('foo')"] = $r->get('foo');
$infos["hasPreviousSession"] = $r->hasPreviousSession();
$infos["hasSession"] = $r->hasSession();
$infos["getClientIps"] = $r->getClientIps();
$infos["getClientIp"] = $r->getClientIp();
$infos["getScriptName"] = $r->getScriptName();
$infos["getPathInfo"] = $r->getPathInfo();
$infos["getBasePath"] = $r->getBasePath();
$infos["getBaseUrl"] = $r->getBaseUrl();
$infos["getScheme"] = $r->getScheme();
$infos["getPort"] = $r->getPort();
$infos["getUser"] = $r->getUser();
$infos["getPassword"] = $r->getPassword();
$infos["getUserInfo"] = $r->getUserInfo();
$infos["getHttpHost"] = $r->getHttpHost();
$infos["getRequestUri"] = $r->getRequestUri();
$infos["getSchemeAndHttpHost"] = $r->getSchemeAndHttpHost();
$infos["getUri"] = $r->getUri();
$infos["getUriForPath('/other-path')"] = $r->getUriForPath('/other-path');
$infos["getRelativeUriForPath('/other-path')"] = $r->getRelativeUriForPath('/other-path');
$infos["getQueryString"] = $r->getQueryString();
$infos["isSecure"] = $r->isSecure();
$infos["getHost"] = $r->getHost();
$infos["getMethod"] = $r->getMethod();
$infos["getRealMethod"] = $r->getRealMethod();
$infos["getRequestFormat"] = $r->getRequestFormat();
$infos["getContentType"] = $r->getContentType();
$infos["getDefaultLocale"] = $r->getDefaultLocale();
$infos["getLocale"] = $r->getLocale();
$infos["isMethodSafe"] = $r->isMethodSafe();
$infos["isMethodIdempotent"] = $r->isMethodIdempotent();
$infos["isMethodCacheable"] = $r->isMethodCacheable();
$infos["isXmlHttpRequest"] = $r->isXmlHttpRequest();
dump($infos); die();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment