Debian Codegraph @

vendor/wikimedia/relpath/README.md

raw
1 RelPath
2 =======
3
4 RelPath is a small PHP library for working with file paths, to join
5 two paths, or find the relative path to a path from the current directory
6 or from an optional start directory.
7
8 Here is how you use it:
9
10 ```php
11 $relPath = \Wikimedia\RelPath::getRelativePath( '/srv/mediawiki/resources/src/startup.js', '/srv/mediawiki' );
12 // Result: "resources/src/startup.js"
13
14 $fullPath = \Wikimedia\RelPath::joinPath( '/srv/mediawiki', 'resources/src/startup.js' );
15 // Result: "/srv/mediawiki/resources/src/startup.js"
16
17 $fullPath = \Wikimedia\RelPath::joinPath( '/srv/mediawiki', '/var/startup/startup.js' );
18 // Result: "/var/startup/startup.js"
19 ```
20
21 The `RelPath::joinPath()` function provided here is analogous to `os.path.join()` in Python,
22 and `path.join()` found in Node.js.
23
24 License
25 -------
26
27 MIT