Ótimo analisador de URL php

Você pode obter resultados variados com parse_urlem php. Esta aula obtém ótimos resultados, confira:
https://github.com/monkeysuffrage/phpuri

Exemplo

require 'phpuri.php';
$uri
= phpUri::parse('https://www.google.com/foo?q=bar');
echo $uri
->scheme;
echo $uri
->authority;
echo $uri
->path;
echo $uri
->query;
//==> https://
//==> google.com
//==> foo
//==> ?q=bar

Benchmarks

rel2abs:         successes -> 26, fails => 9, time: 0.001301
url_to_absolute
: successes -> 32, fails => 3, time: 0.0029089999999999
phpuri
: successes -> 35, fails => 0, time: 0.002402