File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
Changelog
2
2
=========
3
3
4
+ * 2.3.0 (2015-12-17)
5
+
6
+ * added ` Url::makeRelative() ` for calculating relative paths between URLs
7
+ * fixed ` Path::makeRelative() ` to trim leading dots when moving outside of
8
+ the base path
9
+
4
10
* 2.2.3 (2015-10-05)
5
11
6
12
* fixed ` Path::makeRelative() ` to produce ` .. ` when called with the parent
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ Latest release: [2.2.3](https://packagist.org/packages/webmozart/path-util#2.2.3
13
13
PHP >= 5.3.3
14
14
15
15
This package provides robust, cross-platform utility functions for normalizing,
16
- comparing and modifying file paths.
16
+ comparing and modifying file paths and URLs .
17
17
18
18
Installation
19
19
------------
@@ -27,6 +27,8 @@ $ composer require webmozart/path-util:^2.2
27
27
Usage
28
28
-----
29
29
30
+ Use the ` Path ` class to handle file paths:
31
+
30
32
``` php
31
33
use Webmozart\PathUtil\Path;
32
34
@@ -86,11 +88,16 @@ Path::getHomeDirectory();
86
88
// => /home/webmozart
87
89
```
88
90
91
+ Use the ` Url ` class to handle URLs:
92
+
89
93
``` php
90
94
use Webmozart\PathUtil\Url;
91
95
92
- echo Url::makeRelative('http://example.com/webmozart/ css/style.css', 'http://example.com/webmozart /puli');
96
+ echo Url::makeRelative('http://example.com/css/style.css', 'http://example.com/puli');
93
97
// => ../css/style.css
98
+
99
+ echo Url::makeRelative('http://cdn.example.com/css/style.css', 'http://example.com/puli');
100
+ // => http://cdn.example.com/css/style.css
94
101
```
95
102
96
103
Learn more in the [ Documentation] and the [ API Docs] .
You can’t perform that action at this time.
0 commit comments