2017 © Pedro Peláez
 

library uri

An implementation of PSR UriInterface

image

byjg/uri

An implementation of PSR UriInterface

  • Friday, June 1, 2018
  • by byjg
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3,385 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 30 % Grown

The README.md

Uri class

Scrutinizer Code Quality Build Status Opensource ByJG GitHub source GitHub license GitHub release, (*1)

An implementation of PSR-7 UriInterface, (*2)

PSR-7 requires URI compliant with RFC3986. It means the URI output will always be URL encoded. The same is valid for creating a new instance. The only way to store the plain password is using Uri::withUserInfo(), (*3)

For example:, (*4)

$uri = \ByJG\Util\Uri::getInstanceFromString("https://user:pa&@host");
print((string)$uri); // Will print "https://user:pa%26@host"

$uri = \ByJG\Util\Uri::getInstanceFromString("https://user:pa%26@host");
print((string)$uri); // Will print "https://user:pa%26@host"

$uri = \ByJG\Util\Uri::getInstanceFromString("https://host")
    ->withUserInfo("user", "pa%26");
print((string)$uri); // Will print "https://user:pa%2526@host"

Custom methods

This class fully complies with the PSR UriInterface (PSR-7) and also implements some additional useful methods in the \ByJG\Util\CustomUriInterface interface:, (*5)

  • getUsername()
  • getPassword()
  • getQueryPart($key)
  • withQueryKeyValue($key, $value, $encode = true)
  • hasQueryKey(string $key): bool;

For more information about UriInterface, visit: https://github.com/php-fig/http-message/blob/master/src/UriInterface.php, (*6)

Install

composer require "byjg/uri"

Unit tests

vendor/bin/phpunit

Dependencies

flowchart TD
    byjg/uri --> psr/http-message

Open source ByJG, (*7)

The Versions

01/06 2018

dev-master

9999999-dev

An implementation of PSR UriInterface

  Sources   Download

MIT

The Requires

 

The Development Requires

by João Gilberto Magalhães

09/03 2018

1.0.4

1.0.4.0

An implementation of PSR UriInterface

  Sources   Download

MIT

The Requires

 

The Development Requires

by João Gilberto Magalhães

30/11 2017

1.0.3

1.0.3.0

An implementation of PSR UriInterface

  Sources   Download

MIT

The Requires

 

by João Gilberto Magalhães

30/11 2017

1.0.3.x-dev

1.0.3.9999999-dev

An implementation of PSR UriInterface

  Sources   Download

MIT

The Requires

 

by João Gilberto Magalhães

29/05 2017

1.0.2

1.0.2.0

An implementation of PSR UriInterface

  Sources   Download

MIT

The Requires

 

by João Gilberto Magalhães

13/02 2017

1.0.1

1.0.1.0

An implementation of PSR UriInterface

  Sources   Download

MIT

The Requires

 

by João Gilberto Magalhães

05/02 2017

1.0.0

1.0.0.0

An implementation of PSR UriInterface

  Sources   Download

MIT

The Requires

 

by João Gilberto Magalhães