All Projects → thephpleague → Uri

thephpleague / Uri

Licence: mit
URI manipulation Library

Labels

Projects that are alternatives of or similar to Uri

route pattern generator
A Dart static code generator that produces matchers and builders from route uri patterns.
Stars: ✭ 31 (-95.32%)
Mutual labels:  uri
uri-query-parser
a parser and a builder to work with URI query string the right way in PHP
Stars: ✭ 38 (-94.26%)
Mutual labels:  uri
Uri
🌏 Functions for making sense out of URIs in PHP
Stars: ✭ 259 (-60.88%)
Mutual labels:  uri
url-normalize
URL normalization for Python
Stars: ✭ 82 (-87.61%)
Mutual labels:  uri
cryptouri.rs
Rust implementation of CryptoURI: URN-like namespace for cryptographic objects with Bech32-based encoding
Stars: ✭ 33 (-95.02%)
Mutual labels:  uri
BridgeDb
The BridgeDb Library source code
Stars: ✭ 22 (-96.68%)
Mutual labels:  uri
Uri Interfaces
League URI Interfaces
Stars: ✭ 247 (-62.69%)
Mutual labels:  uri
Uri Parser
RFC3986/RFC3987 compliant URI parser
Stars: ✭ 342 (-48.34%)
Mutual labels:  uri
Linkt
A lightweight and simple Kotlin library for deep link handling on Android 🔗.
Stars: ✭ 101 (-84.74%)
Mutual labels:  uri
httoop
HTTOOP - a fully object oriented HTTP protocol library written in python
Stars: ✭ 15 (-97.73%)
Mutual labels:  uri
CP-Badges
Support for Competitive Coding badges to add in Github readme or portfolio websites.
Stars: ✭ 78 (-88.22%)
Mutual labels:  uri
uri
A type to represent, query, and manipulate a Uniform Resource Identifier.
Stars: ✭ 16 (-97.58%)
Mutual labels:  uri
ocaml-uri
RFC3986 URI parsing library for OCaml
Stars: ✭ 85 (-87.16%)
Mutual labels:  uri
ST-OpenUri
The ultimate Sublime Text plugin for opening URIs (URLs) in your file.
Stars: ✭ 25 (-96.22%)
Mutual labels:  uri
Android Nosql
Lightweight, simple structured NoSQL database for Android
Stars: ✭ 284 (-57.1%)
Mutual labels:  uri
jurl
Fast and simple URL parsing for Java, with UTF-8 and path resolving support
Stars: ✭ 84 (-87.31%)
Mutual labels:  uri
MSEdgeRedirect
A Tool to Redirect News, Search, Widgets, Weather and More to Your Default Browser
Stars: ✭ 1,381 (+108.61%)
Mutual labels:  uri
Tld.js
JavaScript API to work easily with complex domain names, subdomains and well-known TLDs.
Stars: ✭ 399 (-39.73%)
Mutual labels:  uri
Searchwithmybrowser
Open Cortana searches with your default browser.
Stars: ✭ 285 (-56.95%)
Mutual labels:  uri
UrlCombine
C# util for combining Url paths. Works similarly to Path.Combine.
Stars: ✭ 23 (-96.53%)
Mutual labels:  uri

URI

Build Software License Latest Version Total Downloads

The Uri package provides simple and intuitive classes to manage URIs in PHP. You will be able to

  • parse, build and resolve URIs
  • create URIs from different sources (string, PHP environment, base URI, URI template, ...);
  • handle internalisation;
  • infer properties and features from URIs;
<?php

use League\Uri\UriTemplate;

$template = 'https://api.twitter.com:443/{version}/search/{term:1}/{term}/{?q*,limit}#title';
$defaultVariables = ['version' => '1.1'];
$params = [
    'term' => 'john',
    'q' => ['a', 'b'],
    'limit' => '10',
];

$uriTemplate = new UriTemplate($template, $defaultVariables);
$uri = $uriTemplate->expand($params);
// $uri is a League\Uri\Uri object

echo $uri->getScheme();    //displays "https"
echo $uri->getAuthority(); //displays "api.twitter.com:443"
echo $uri->getPath();      //displays "/1.1/search/j/john/"
echo $uri->getQuery();     //displays "q=a&q=b&limit=10"
echo $uri->getFragment();  //displays "title"
echo $uri;
//displays "https://api.twitter.com:443/1.1/search/j/john/?q=a&q=b&limit=10#title"
echo json_encode($uri);
//displays "https:\/\/api.twitter.com:443\/1.1\/search\/j\/john\/?q=a&q=b&limit=10#title"

Highlights

System Requirements

  • You require PHP >= 7.2 but the latest stable version of PHP is recommended
  • You will need the ext-intl to handle i18n URI.
  • Since version 6.2.0 you will need the ext-fileinfo to handle Data URI creation from a filepath.

Dependencies

In order to handle IDN host you are required to also install the intl extension otherwise an exception will be thrown when attempting to validate such host.

In order to create Data URI from a filepath, since version 6.2, you are required to also install the fileinfo extension otherwise an exception will be thrown.

Installation

$ composer require league/uri

Documentation

Full documentation can be found at uri.thephpleague.com.

Contributing

Contributions are welcome and will be fully credited. Please see CONTRIBUTING and CONDUCT for details.

Testing

The library has a :

  • a PHPUnit test suite
  • a coding style compliance test suite using PHP CS Fixer.
  • a code analysis compliance test suite using PHPStan.

To run the tests, run the following command from the project folder.

$ composer test

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

Attribution

The UriTemplate class is adapted from the Guzzle 6 project.

License

The MIT License (MIT). Please see License File for more information.

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