2017 © Pedro Peláez
 

library url-util

A PHP library providing common URL implementation.

image

markenwerk/url-util

A PHP library providing common URL implementation.

  • Monday, December 19, 2016
  • by bonscho
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,061 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 39 % Grown

The README.md

PHP URL Util

Build Status Test Coverage Dependency Status SensioLabs Insight Code Climate Latest Stable Version Total Downloads License, (*1)

A PHP library providing common URL implementation., (*2)

Installation

```{json} { "require": { "chroma-x/url-util": "~2.0" } }, (*3)


## Usage ### Autoloading and namesapce ```{php} require_once('path/to/vendor/autoload.php');

Parsing an URL

```{php} use ChromaX\UrlUtil;, (*4)

$url = new UrlUtil\Url('https://john:secret@mydomain.com:8443/path/to/resource?arg1=123&arg2=test#fragment');, (*5)

$scheme = $url->getScheme(); fwrite(STDOUT, 'Scheme "' . $scheme . '"' . PHP_EOL);, (*6)

$hostname = $url->getHostname(); fwrite(STDOUT, 'Hostname "' . $hostname . '"' . PHP_EOL);, (*7)

$port = $url->getPort(); fwrite(STDOUT, 'Port "' . (string)$port . '"' . PHP_EOL);, (*8)

$username = $url->getUsername(); fwrite(STDOUT, 'Username "' . $username . '"' . PHP_EOL);, (*9)

$password = $url->getPassword(); fwrite(STDOUT, 'Password "' . $password . '"' . PHP_EOL);, (*10)

$path = $url->getPath(); fwrite(STDOUT, 'Path "' . $path . '"' . PHP_EOL);, (*11)

$queryParameters = $url->getQueryParameters(); foreach ($queryParameters as $queryParameter) { fwrite(STDOUT, 'Query parameter "' . $queryParameter->getKey() . '" is "' . $queryParameter->getValue() . '"' . PHP_EOL); }, (*12)

$fragment = $url->getFragment(); fwrite(STDOUT, 'Fragment "' . $fragment . '"' . PHP_EOL);, (*13)

$url ->setScheme('http') ->setHostname('yourdomain.com') ->setPort(8080) ->setUsername('doe') ->setPassword('supersecret') ->setPath('path/to/another/resource') ->removeQueryParameterByKey('arg2') ->addQueryParameter(new UrlUtil\QueryParameter('arg1', '456')) ->addQueryParameter(new UrlUtil\QueryParameter('arg3', 'test')) ->setFragment('target');, (*14)

fwrite(STDOUT, 'URL "' . $url->buildUrl() . '"' . PHP_EOL);, (*15)


will output the following ```{http} Scheme "https" Hostname "mydomain.com" Port "8443" Username "john" Password "secret" Path "/path/to/resource" Query parameter "arg1" is "123" Query parameter "arg2" is "test" Fragment "fragment" URL "http://doe:supersecret@yourdomain.com:8080/path/to/another/resource?arg1=456&arg3=test#target"

Contribution

Contributing to our projects is always very appreciated.
But: please follow the contribution guidelines written down in the CONTRIBUTING.md document., (*16)

License

PHP URL Util is under the MIT license., (*17)

The Versions

19/12 2016

dev-master

9999999-dev http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

19/12 2016

2.0.6

2.0.6.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

15/07 2016

2.0.5

2.0.5.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

12/07 2016

2.0.4

2.0.4.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

12/07 2016

2.0.2

2.0.2.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

12/07 2016

2.0.3

2.0.3.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

11/07 2016

2.0.1

2.0.1.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

06/07 2016

2.0.0

2.0.0.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

02/05 2016

1.0.4

1.0.4.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

02/05 2016

1.0.3

1.0.3.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

02/05 2016

1.0.2

1.0.2.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

02/05 2016

1.0.1

1.0.1.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url

02/05 2016

1.0.0

1.0.0.0 http://markenwerk.net/

A PHP library providing common URL implementation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url