https://github.com/wikimedia/relpath
Mirror from https://gerrit.wikimedia.org/g/RelPath. See https://www.mediawiki.org/wiki/Developer_access for contributing.
https://github.com/wikimedia/relpath
Last synced: about 2 months ago
JSON representation
Mirror from https://gerrit.wikimedia.org/g/RelPath. See https://www.mediawiki.org/wiki/Developer_access for contributing.
- Host: GitHub
- URL: https://github.com/wikimedia/relpath
- Owner: wikimedia
- License: mit
- Created: 2015-09-28T22:51:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-17T17:43:46.000Z (3 months ago)
- Last Synced: 2025-04-09T19:18:41.757Z (about 2 months ago)
- Language: PHP
- Homepage: https://www.mediawiki.org/wiki/RelPath
- Size: 109 KB
- Stars: 11
- Watchers: 14
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
RelPath
=======RelPath is a small PHP library for working with file paths, to join
two paths, or find the relative path to a path from the current directory
or from an optional start directory.Here is how you use it:
```php
$relPath = \Wikimedia\RelPath::getRelativePath( '/srv/mediawiki/resources/src/startup.js', '/srv/mediawiki' );
// Result: "resources/src/startup.js"$fullPath = \Wikimedia\RelPath::joinPath( '/srv/mediawiki', 'resources/src/startup.js' );
// Result: "/srv/mediawiki/resources/src/startup.js"$fullPath = \Wikimedia\RelPath::joinPath( '/srv/mediawiki', '/var/startup/startup.js' );
// Result: "/var/startup/startup.js"
```The `RelPath::joinPath()` function provided here is analogous to `os.path.join()` in Python,
and `path.join()` found in Node.js.License
-------MIT