Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Parse a URL and return its components
parse_url(string $url, int $component = -1): int|string|array|null|false
protected function replaceBaseUrl($uri, $url)
{
$parsed = parse_url($url);
return $uri
->withScheme($parsed['scheme'])
{
$parsed = parse_url($url);
return $uri
->withScheme($parsed['scheme'])
{
$uri = $app->make('config')->get('app.url', 'http://localhost');
$components = parse_url($uri);
$server = $_SERVER;
$uri = $app->make('config')->get('app.url', 'http://localhost');
$components = parse_url($uri);
$server = $_SERVER;
$publicPath = getcwd();
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? ''
);
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? ''
);
protected function allSubdomainsOfApplicationUrl()
{
if ($host = parse_url($this->app['config']->get('app.url'), PHP_URL_HOST)) {
return '^(.+\.)?'.preg_quote($host).'$';
}
}
{
if ($host = parse_url($this->app['config']->get('app.url'), PHP_URL_HOST)) {
return '^(.+\.)?'.preg_quote($host).'$';
}
}
if (! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) {
$uri = preg_replace('/#.*/', '', $uri);
}
$uri = preg_replace('/#.*/', '', $uri);
}
{
$url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url);
$parsedUrl = parse_url($url);
if ($parsedUrl === false) {
throw new InvalidArgumentException('The database configuration URL is malformed.');
$url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url);
$parsedUrl = parse_url($url);
if ($parsedUrl === false) {
throw new InvalidArgumentException('The database configuration URL is malformed.');
return false;
}
if ($url = parse_url($value, PHP_URL_HOST)) {
try {
return count(dns_get_record($url.'.', DNS_A | DNS_AAAA)) > 0;
} catch (Exception $e) {
}
if ($url = parse_url($value, PHP_URL_HOST)) {
try {
return count(dns_get_record($url.'.', DNS_A | DNS_AAAA)) > 0;
} catch (Exception $e) {
$response = new RedirectResponse('foo.bar');
$response->withFragment('foo');
$this->assertSame('foo', parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$response->withFragment('#bar');
$this->assertSame('bar', parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$response->withFragment('foo');
$this->assertSame('foo', parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$response->withFragment('#bar');
$this->assertSame('bar', parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$this->assertSame('foo', parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$response->withFragment('#bar');
$this->assertSame('bar', parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$response->withoutFragment();
$this->assertNull(parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$response->withFragment('#bar');
$this->assertSame('bar', parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$response->withoutFragment();
$this->assertNull(parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$this->assertSame('bar', parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
$response->withoutFragment();
$this->assertNull(parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
}
public function testInputOnRedirect()
$response->withoutFragment();
$this->assertNull(parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
}
public function testInputOnRedirect()