Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #57 from sunrise-php/release/v1.2.5
Browse files Browse the repository at this point in the history
v1.2.5
  • Loading branch information
fenric committed Dec 31, 2022
2 parents 2ea4d97 + 173364e commit cf636bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 97 deletions.
97 changes: 1 addition & 96 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,96 +1 @@
## URI wrapper for PHP 7.1+ based on RFC-3986, PSR-7 and PSR-17

[![Gitter](https://badges.gitter.im/sunrise-php/support.png)](https://gitter.im/sunrise-php/support)
[![Build Status](https://scrutinizer-ci.com/g/sunrise-php/uri/badges/build.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/uri/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sunrise-php/uri/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/uri/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/sunrise-php/uri/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/uri/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/sunrise/uri/v/stable?format=flat)](https://packagist.org/packages/sunrise/uri)
[![Total Downloads](https://poser.pugx.org/sunrise/uri/downloads?format=flat)](https://packagist.org/packages/sunrise/uri)
[![License](https://poser.pugx.org/sunrise/uri/license?format=flat)](https://packagist.org/packages/sunrise/uri)

---

## Installation

```bash
composer require sunrise/uri
```

## How to use?

```php
use Sunrise\Uri\Uri;
use Sunrise\Uri\UriFactory;

// creates a new URI
$uri = new Uri('http://user:pass@localhost:3000/path?query#fragment');

// creates a new URI with a factory (is equivalent to new Uri(string))
$uri = (new UriFactory)->createUri('http://user:pass@localhost:3000/path?query#fragment');

// list of withers
$uri->withScheme();
$uri->withUserInfo();
$uri->withHost();
$uri->withPort();
$uri->withPath();
$uri->withQuery();
$uri->withFragment();

// list of getters
$uri->getScheme();
$uri->getUserInfo();
$uri->getHost();
$uri->getPort();
$uri->getPath();
$uri->getQuery();
$uri->getFragment();
$uri->getAuthority();

// converts the URI to a string
(string) $uri;
```

### Another schemes

```php
$uri = new Uri('mailto:[email protected]');

$uri->getScheme(); // mailto
$uri->getPath(); // [email protected]
```

```php
$uri = new Uri('maps:?q=112+E+Chapman+Ave+Orange,+CA+92866');

$uri->getScheme(); // maps
$uri->getQuery(); // q=112+E+Chapman+Ave+Orange,+CA+92866
```

```php
$uri = new Uri('tel:+1-816-555-1212');

$uri->getScheme(); // tel
$uri->getPath(); // +1-816-555-1212
```

```php
$uri = new Uri('urn:oasis:names:specification:docbook:dtd:xml:4.1.2');

$uri->getScheme(); // urn
$uri->getPath(); // oasis:names:specification:docbook:dtd:xml:4.1.2
```

---

## Test run

```bash
php vendor/bin/phpunit
```

## Useful links

* https://tools.ietf.org/html/rfc3986
* https://www.php-fig.org/psr/psr-7/
* https://www.php-fig.org/psr/psr-17/
⚠️ This package was **moved** to the [http-message](https://github.com/sunrise-php/http-message) package and is abandoned.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
"phpdoc -d src/ -t phpdoc/",
"XDEBUG_MODE=coverage phpunit --coverage-html coverage/"
]
}
},
"abandoned": "sunrise/http-message"
}

0 comments on commit cf636bb

Please sign in to comment.