Skip to content

Commit 57c2492

Browse files
committed
Content tweaks.
1 parent 2da406b commit 57c2492

File tree

2 files changed

+22
-62
lines changed

2 files changed

+22
-62
lines changed

README.md

Lines changed: 21 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,28 @@
11
sabre/uri
22
=========
33

4-
Functions that help with uris.
4+
sabre/uri is a lightweight library that provides several functions for working
5+
with URIs, staying true to the rules of [RFC3986][2].
56

7+
Partially inspired by [Node.js URL library][3], and created to solve real
8+
problems in PHP applications. 100% unitested and many tests are based on
9+
examples from RFC3986.
610

7-
Installation
8-
------------
9-
10-
Make sure you have [composer][3] installed, and then run:
11-
12-
composer require sabre/uri
13-
14-
15-
Usage
16-
-----
17-
18-
This package provides 2 functions:
19-
20-
1. `resolve`
21-
2. `splitPath`
22-
23-
### resolve
24-
25-
Resolves a relative url based on another url.
26-
27-
Sabre\Uri::resolve(
28-
'http://example.org/foo/bar/',
29-
'/'
30-
);
31-
// Result: http://example.org/
32-
33-
Sabre\Uri::resolve(
34-
'/foo/',
35-
'?a=b'
36-
);
37-
// Result: /foo/?a=b
38-
39-
40-
### split
41-
42-
This is a combination of PHP's [`dirname`][6] and [`basename`][7],
43-
without being affected by locale settings.
44-
45-
list(
46-
$parent,
47-
$baseName
48-
) = split('http://example.org/foo/bar');
11+
The library provides the following functions:
4912

50-
echo $parent, " ", $baseName;
51-
// output : http://example.org/foo bar
13+
1. `resolve` to resolve relative urls.
14+
2. `normalize` to aid in comparing urls.
15+
3. `parse`, which works like PHP's [parse_url][6].
16+
4. `build` to do the exact opposite of `parse`.
17+
5. `split` to easily get the 'dirname' and 'basename' of a URL without all the
18+
problems those two functions have.
5219

53-
list(
54-
$parent,
55-
$baseName
56-
) = split('directory/file');
5720

58-
echo $parent, " ", $baseName;
59-
// output : directory file
21+
Further reading
22+
---------------
6023

61-
* Unlike dirname/basename, this method only treats `/` as a directory
62-
separator.
63-
* Unlike dirname/basename, the behavior of this method does not change
64-
depending on the system's locale setting.
65-
* Slashes appearing at the end of the path input path will be ignored.
66-
* If there's no 'dirname' part, because the path only has a single relative
67-
component, an empty string will be returned.
24+
* [Installation][7]
25+
* [Usage][8]
6826

6927

7028
Build status
@@ -88,8 +46,10 @@ Made at fruux
8846
This library is being developed by [fruux](https://fruux.com/). Drop us a line for commercial services or enterprise support.
8947

9048
[1]: http://sabre.io/uri/
91-
[3]: http://getcomposer.org/
49+
[2]: https://tools.ietf.org/html/rfc3986/
50+
[3]: http://nodejs.org/api/url.html
9251
[4]: http://groups.google.com/group/sabredav-discuss
9352
[5]: https://github.com/fruux/sabre-uri/issues/
94-
[6]: http://php.net/manual/en/function.dirname.php
95-
[7]: http://php.net/manual/en/function.basename.php
53+
[6]: http://php.net/manual/en/function.parse-url.php
54+
[7]: /uri/install/
55+
[8]: /uri/usage/

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sabre/uri",
3-
"description": "A PHP library for URI manipulation.",
3+
"description": "Functions for making sense out of URIs.",
44
"keywords": [
55
"URI",
66
"URL",

0 commit comments

Comments
 (0)