All Projects → fluffy-critter → php-urljoin

fluffy-critter / php-urljoin

Licence: MIT license
A library function for joining a base URL and a target URL into a an absolute URL

Programming Languages

PHP
23972 projects - #3 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to php-urljoin

uri
A type to represent, query, and manipulate a Uniform Resource Identifier.
Stars: ✭ 16 (+23.08%)
Mutual labels:  url-parsing
Kit-UrlParser
RFC 3986 compliant url parsing library with PSR-7 Uri component
Stars: ✭ 31 (+138.46%)
Mutual labels:  url-parsing
jurl
Fast and simple URL parsing for Java, with UTF-8 and path resolving support
Stars: ✭ 84 (+546.15%)
Mutual labels:  url-parsing
Scala Uri
Simple scala library for building and parsing URIs
Stars: ✭ 225 (+1630.77%)
Mutual labels:  url-parsing
Urlformat
Type safe url pattern matching without regular expressions and arguments type mismatches based on parser combinators.
Stars: ✭ 213 (+1538.46%)
Mutual labels:  url-parsing
Hyperlink
🔗 Immutable, Pythonic, correct URLs.
Stars: ✭ 198 (+1423.08%)
Mutual labels:  url-parsing
Furl
🌐 URL parsing and manipulation made easy.
Stars: ✭ 2,152 (+16453.85%)
Mutual labels:  url-parsing
Faup
Fast URL decoder library
Stars: ✭ 159 (+1123.08%)
Mutual labels:  url-parsing
Tldts
JavaScript Library to work against complex domain names, subdomains and URIs.
Stars: ✭ 151 (+1061.54%)
Mutual labels:  url-parsing
Galimatias
galimatias is a URL parsing and normalization library written in Java.
Stars: ✭ 146 (+1023.08%)
Mutual labels:  url-parsing
Uddup
Urls de-duplication tool for better recon.
Stars: ✭ 103 (+692.31%)
Mutual labels:  url-parsing
Libvmod Querystring
Query-string module for Varnish Cache
Stars: ✭ 85 (+553.85%)
Mutual labels:  url-parsing
Urllib
A modern URL toolset for Java. Compliant with RFC 3986.
Stars: ✭ 77 (+492.31%)
Mutual labels:  url-parsing
Universal Url
WHATWG URL for Node & Browser.
Stars: ✭ 20 (+53.85%)
Mutual labels:  url-parsing
Qs
A querystring parser with nesting support
Stars: ✭ 6,688 (+51346.15%)
Mutual labels:  url-parsing
Yarl
Yet another URL library
Stars: ✭ 617 (+4646.15%)
Mutual labels:  url-parsing
Url Knife
Extract and decompose (fuzzy) URLs (including emails, which are conceptually a part of URLs) in texts with robust patterns.
Stars: ✭ 298 (+2192.31%)
Mutual labels:  url-parsing
Frontexpress
An Express.js-Style router for the front-end
Stars: ✭ 263 (+1923.08%)
Mutual labels:  url-parsing
tall
Promise-based, No-dependency URL unshortner (expander) module for Node.js
Stars: ✭ 56 (+330.77%)
Mutual labels:  url-parsing

php-urljoin

A PHP library function for joining a base URL and a potentially-relative target URL into an absolute URL

Why isn't this in the PHP standard library? WHO KNOWS.

Installation:

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

usage:

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).

Other things that you might know this as:

  • 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)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].