https://github.com/phlib/path
PHP path handling component for dealing with escaped directory separators
https://github.com/phlib/path
Last synced: about 1 month ago
JSON representation
PHP path handling component for dealing with escaped directory separators
- Host: GitHub
- URL: https://github.com/phlib/path
- Owner: phlib
- License: lgpl-3.0
- Created: 2016-07-15T14:22:36.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2025-01-29T14:27:26.000Z (over 1 year ago)
- Last Synced: 2025-04-17T13:02:52.731Z (about 1 year ago)
- Language: PHP
- Size: 42 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# phlib/path
[](https://github.com/phlib/path/actions/workflows/code-checks.yml)
[](https://codecov.io/gh/phlib/path)
[](https://packagist.org/packages/phlib/path)
[](https://packagist.org/packages/phlib/path)

PHP path handling component for dealing with escaped directory separators
## Install
Via Composer
``` bash
$ composer require phlib/path
```
## Usage
Creation of path instance
``` php
$path = \Phlib\Path::fromString('foo/bar/baz');
$info = $path->info(); // should return the same as `pathinfo`
```
Using path to parse paths with escaped directory separators
``` php
$path = \Phlib\Path::fromString('foo/bar\\/baz');
echo $path->info(\Phlib\Path::INFO_BASENAME); // bar\/baz
```
Build paths with escaped separators
``` php
$parts = ['foo', 'bar/baz', 'taz'];
$path = new \Phlib\Path($parts);
echo $path->toString(); // foo/bar\/baz/taz
```
## License
This package is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see .