phlib/path

PHP path handling component for dealing with escaped directory separators

2.1.0 2021-09-11 07:39 UTC

This package is auto-updated.

Last update: 2024-03-31 18:06:25 UTC


README

Code Checks Codecov Latest Stable Version Total Downloads Licence

PHP path handling component for dealing with escaped directory separators

Install

Via Composer

$ composer require phlib/path

Usage

Creation of path instance

$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

$path = \Phlib\Path::fromString('foo/bar\\/baz');
echo $path->info(\Phlib\Path::INFO_BASENAME); // bar\/baz

Build paths with escaped separators

$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 http://www.gnu.org/licenses/.