You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.7 KiB
Markdown
56 lines
1.7 KiB
Markdown
2 years ago
|
# PHP Path Library
|
||
|
|
||
|
[](https://packagist.org/packages/arokettu/path)
|
||
|
[](https://packagist.org/packages/arokettu/path)
|
||
|
[](https://opensource.org/licenses/MIT)
|
||
|
[](https://gitlab.com/sandfox/php-path/-/pipelines)
|
||
|
[](https://codecov.io/gl/sandfox/php-path/)
|
||
|
|
||
|
A PHP library to work with absolute and relative paths.
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
```php
|
||
|
<?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
|
||
|
```
|
||
|
|
||
|
## Installation
|
||
|
|
||
|
```bash
|
||
|
composer require arokettu/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>
|
||
|
|
||
|
## License
|
||
|
|
||
|
The library is available as open source under the terms of the [MIT License].
|
||
|
|
||
|
[MIT License]: https://opensource.org/licenses/MIT
|