2017 © Pedro Peláez
 

library url

Parse, build and manipulate URL's

image

hoangphison/url

Parse, build and manipulate URL's

  • Monday, November 27, 2017
  • by hoangphison
  • Repository
  • 0 Watchers
  • 0 Stars
  • 55 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 21 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Parse, build and manipulate URL's

Build Status StyleCI, (*1)

A simple package to deal with URL's in your applications., (*2)

Retrieve parts of the URL:, (*3)

$url = Url::fromString('https://spatie.be/opensource');

echo $url->getScheme(); // 'https'
echo $url->getHost(); // 'spatie.be'
echo $url->getPath(); // '/opensource'

Transform any part of the URL (the Url class is immutable):, (*4)

$url = Url::fromString('https://spatie.be/opensource');

echo $url->withHost('github.com')->withPath('spatie');
// 'https://github.com/spatie'

Retrieve and transform query parameters:, (*5)

$url = Url::fromString('https://spatie.be/opensource?utm_source=github&utm_campaign=pacakges');

echo $url->getQuery(); // 'utm_source=github&utm_campaign=pacakges'
echo $url->getQueryParameter('utm_source'); // 'github'
echo $url->withoutQueryParameter('utm_campaign'); // 'https://spatie.be/opensource?utm_source=github'

Retrieve path segments:, (*6)

$url = Url::fromString('https://spatie.be/opensource/laravel');

echo $url->getSegment(1); // 'opensource'
echo $url->getSegment(2); // 'laravel'

Implements PSR-7's UriInterface interface:, (*7)

class Url implements UriInterface { /* ... */ }

The league/uri is a more powerful package than this one. The main reason this package exists, is because the alternatives requires non-standard php extensions. If you're dealing with special character encodings or need bulletproof validation, you're definitely better off using league/uri., (*8)

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website., (*9)

Installation

You can install the package via composer:, (*10)

``` bash composer require hoangphison/url, (*11)


## Usage Usage is pretty straightforward. Check out the code examples at the top of this readme. ## Changelog Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. ## Testing ``` bash $ composer test

Contributing

Please see CONTRIBUTING for details., (*12)

Security

If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker., (*13)

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using., (*14)

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium., (*15)

We publish all received postcards on our company website., (*16)

Credits

Support us

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website., (*17)

Does your business depend on our contributions? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff., (*18)

License

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

The Versions

27/11 2017

dev-master

9999999-dev https://github.com/hoangphison/url

Parse, build and manipulate URL's

  Sources   Download

MIT

The Requires

 

The Development Requires

url spatie hoangphison

27/11 2017

1.0.0

1.0.0.0 https://github.com/hoangphison/url

Parse, build and manipulate URL's

  Sources   Download

MIT

The Requires

 

The Development Requires

url spatie hoangphison

27/11 2017

dev-release/1.0.0

dev-release/1.0.0 https://github.com/hoangphison/url

Parse, build and manipulate URL's

  Sources   Download

MIT

The Requires

 

The Development Requires

url spatie hoangphison

27/11 2017

dev-feature/php5.6-compatibility

dev-feature/php5.6-compatibility https://github.com/hoangphison/url

Parse, build and manipulate URL's

  Sources   Download

MIT

The Requires

 

The Development Requires

url spatie hoangphison

26/09 2016

dev-code-review

dev-code-review https://github.com/spatie/url

Parse, build and manipulate URL's

  Sources   Download

MIT

The Requires

 

The Development Requires

url spatie