Derives an absolute URL from relative and source URLs

Installs: 6 167

Dependents: 10

Stars: 8

Watchers: 1

Forks: 1

Language: PHP

1.5.1 2014-10-20 06:50 UTC



Derives absolute URL from relative and source URLs.

Useful when:

  • extracting full HREF URLs for links in a HTML document
  • determining absolute new URL for a 301 redirect where the HTTP server returned a relative Location value


The "Hello World" example

$deriver = new \webignition\AbsoluteUrlDeriver\AbsoluteUrlDeriver(

$this->assertEquals('http://www.example.com/server.php?param1=value1', $deriver->getAbsoluteUrl());


Using as a library in a project

If used as a dependency by another project, update that project's composer.json and update your dependencies.

"require": {
    "webignition/absolute-url-deriver": "*"      

This project has external dependencies managed with composer. Get and install this first.

# Make a suitable project directory
mkdir ~/absolute-url-deriver && cd ~/absolute-url-deriver

# Clone repository
git clone git@github.com:webignition/absolute-url-deriver.git.

# Retrieve/update dependencies
composer.phar install


Have look at the project on travis for the latest build status, or give the tests a go yourself.

cd ~/absolute-url-deriver
phpunit tests