2017 © Pedro Peláez
 

library urljoin

Library to correctly join relative and absolute URLs

image

busybee/urljoin

Library to correctly join relative and absolute URLs

  • Friday, April 6, 2018
  • by fluffy.critter
  • Repository
  • 1 Watchers
  • 6 Stars
  • 42 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 1 Versions
  • 14 % Grown

The README.md

php-urljoin

A PHP library function for joining a base URL and a potentially-relative target URL into an absolute URL, (*1)

Why isn't this in the PHP standard library? WHO KNOWS., (*2)

Installation:, (*3)

  • Direct install: just pull src/urljoin.php into your project
  • Composer: composer require busybee/urljoin

usage:, (*4)

urljoin($base_url, $other_url);

See tests.php for test suite, as well as expected inputs and outputs. (Doing this correctly is way more complicated thing than you'd think!) This implementation strives for accuracy and, in cases of ambiguity (such as ../ stack underflow and empty path components), defers to Python's standard library behavior (as implemented by urlparse.urljoin)., (*5)

Other things that you might know this as:, (*6)

  • Relative path concatenation
  • A function for converting a relative path to an absolute URL given a base URL
  • rel2abs and relativeToAbsolute (common names for this sort of function)

The Versions

06/04 2018

dev-master

9999999-dev

Library to correctly join relative and absolute URLs

  Sources   Download

MIT Apache-2.0 Apache

The Requires

  • php >=5.0.0

 

http rel2abs relative2absolute urllib urljoin url-concatenation