Commit 5efc3b14 authored by Sebastian De Deyne's avatar Sebastian De Deyne


parent 330e362e
# Very short description of the package
# Parse, build and manipulate URL's
[![Latest Version on Packagist](](
[![Software License](](
......@@ -7,7 +7,53 @@
[![Quality Score](](
[![Total Downloads](](
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
A simple package to deal with URL's in your applications.
Retrieve parts of the URL:
$url = Url::fromString('');
echo $url->getScheme(); // 'https'
echo $url->getHost(); // ''
echo $url->getPath(); // '/opensource'
Transform any part of the URL (the `Url` class is immutable):
$url = Url::fromString('');
echo $url->withHost('')->withPath('spatie');
// ''
Retrieve and transform query parameters:
$url = Url::fromString('');
echo $url->getQuery(); // 'utm_source=github&utm_campaign=pacakges'
echo $url->getQueryParameter('utm_source'); // 'github'
echo $url->withoutQueryParameter('utm_campaign'); // ''
Retrieve path segments:
$url = Url::fromString('');
echo $url->getSegment(1); // 'opensource'
echo $url->getSegment(2); // 'laravel'
Implements PSR-7's `UriInterface` interface:
class Url implements UriInterface { /* ... */ }
The [`league/uri`]( is a more powerful package than this one. The main reason this package exists, is because the the alternative 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`.
Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](
......@@ -21,13 +67,6 @@ The best postcards will get published on the open source page on our website.
## Installation
**Note:** Remove this paragraph if you are building a public package
This package is custom built for [Spatie]( projects and is therefore not registered on packagist. In order to install it via composer you must specify this extra repository in `composer.json`:
"repositories": [ { "type": "composer", "url": "" } ]
You can install the package via composer:
``` bash
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment