arokettu / path
Path manipulation library
2.0.3
2024-07-28 20:00 UTC
Requires
- php: ^8.0
- nikic/iter: ^2.0
- symfony/polyfill-php81: ^1.22
Requires (Dev)
- phpunit/phpunit: ^9.5
- psy/psysh: *
- sandfox.dev/code-standard: ^1.2023.06.29
- squizlabs/php_codesniffer: *
- vimeo/psalm: ^5.15
README
A PHP library to work with absolute and relative paths.
Installation
composer require arokettu/path
Usage
<?php use Arokettu\Path\PathUtils; use Arokettu\Path\RelativePath; use Arokettu\Path\UrlPath; // simple interface PathUtils::resolveRelativePath('/some/path', '../other/path'); // => /some/other/path PathUtils::makeRelativePath('/some/path', '/some/other/path'); // => ../other/path // OOP interface, more control $url = UrlPath::parse('https://example.com/some/path'); $rel = RelativePath::unix('../other/path'); $url->resolveRelative($rel)->toString(); // => https://example.com/some/other/path
Documentation
Read full documentation here: https://sandfox.dev/php/path.html
Also on Read the Docs: https://php-path.readthedocs.io/
Support
Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/path/-/issues
Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community
License
The library is available as open source under the terms of the MIT License.