wikimedia/relpath

Compute a relative filepath between two paths.

2.1.1 2018-01-18 21:23 UTC

README

RelPath is a small PHP library for computing a relative filepath to some path, either from the current directory or from an optional start directory.

Here is how you use it:

$relPath = \Wikimedia\RelPath::getRelativePath( '/srv/mediawiki/resources/src/startup.js', '/srv/mediawiki' );
// Result: string(24) "resources/src/startup.js"

$fullPath = \Wikimedia\RelPath::joinPath( '/srv/mediawiki', 'resources/src/startup.js' );
// Result: string(39) "/srv/mediawiki/resources/src/startup.js"

License

MIT