PHPackages                             mattwright/urlresolver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mattwright/urlresolver

ActiveLibrary

mattwright/urlresolver
======================

PHP class that attempts to resolve URLs to a final, canonical link.

2.0(7y ago)66141.1k↓17.4%22[5 issues](https://github.com/mattwright/URLResolver.php/issues)[1 PRs](https://github.com/mattwright/URLResolver.php/pulls)MITPHPPHP &gt;=5.3

Since Jan 18Pushed 7y ago10 watchersCompare

[ Source](https://github.com/mattwright/URLResolver.php)[ Packagist](https://packagist.org/packages/mattwright/urlresolver)[ Docs](https://github.com/mattwright/URLResolver.php)[ RSS](/packages/mattwright-urlresolver/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Welcome to URLResolver.php
==========================

[](#welcome-to-urlresolverphp)

URLResolver.php is a PHP class that attempts to resolve URLs to a final, canonical link. On the web today, link shorteners, tracking codes and more can result in many different links that ultimately point to the same resource. By following HTTP redirects and parsing web pages for open graph and canonical URLs, URLResolver.php attempts to solve this issue.

Patterns Recognized
-------------------

[](#patterns-recognized)

- Follows 301, 302, and 303 redirects found in HTTP headers
- Follows [Open Graph](https://developers.facebook.com/docs/opengraph/) URL &lt;meta&gt; tags found in web page &lt;head&gt;
- Follows [Canonical](http://www.google.com/support/webmasters/bin/answer.py?answer=139394) URL &lt;link&gt; tags found in web page &lt;head&gt;
- Aborts download quickly if content type is not an HTML page

I am open to additional suggestions for improvement.

Usage
-----

[](#usage)

Resolving a URL can be as easy as:

```
