Overview
The Link API is a set of modules for managing URLs.
The basic API module provides no useful end-user functionality on its own, but does provide a flexible API for storing and retrieving URL information in the database. It can be leveraged by other modules which need to keep track of link information.
7.x Features
The 7.x branch has none of the modules of 6.x currently, however they may be ported in the future. Currently, it consists entirely of classes for normalising, validating and manipulating URLs. You should only install if you require it for another module, or want to use its features in your own code.
NOTE The internal API changed in a recent 7.x-2.x development snapshot. If you are using it in your own project you may need to update some of your code.
Usage
To normalise and sanitize a URL...
$link = link_api_url('http://example.com/some/path')
$url = $link->getUrl();
To load a URL helper:
<?php
// Normalise.
$normalised_url = link_api_helper()->normaliseURL($url);
// Convert a relative link to an absolute link.
$base_url = 'http://someurl.com/with/other/parts';
$url_parts = link_api_url('with/parts')
->getParts(PHP_URL_PATH);
$url = link_api_helper()->relativeToAbsolute($base_url, $url_parts);
// Normalise a query string.