grandt/relativepath (packagist): A class for cleaning up/collapsing relative paths. Like real_path, but without the need for the path to exist on the filesystem.
Keywords: file path