Manipulation of the file system paths
PHP Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
adapters
doc
helpers
params
tests
.gitattributes
.gitignore
.travis.yml
Base.php
CHANGELOG.md
LICENSE
Paths.php
Posix.php
README.md
URL.php
Windows.php
composer.json
cs.sh
index.php
phpmd.sh
phpmd.xml.dist
phpunit.xml.dist

README.md

axy\fs-paths

Manipulation of the file system paths.

Latest Stable Version Minimum PHP Version Build Status Coverage Status License

  • The library does not require any dependencies (except composer packages).
  • Tested on PHP 5.4+, PHP 7, HHVM (on Linux), PHP 5.5 (on Windows).
  • Install: composer require axy/fs-paths.
  • License: MIT.

Documentation

The library provides functions for work with file paths. Normalization, resolving and etc.

The library works with abstract paths. No requests to the real file system.

Contents

Examples

use axy\fs\paths\Paths;

/* Static methods */
Paths::normalize('/one/two/../three'); // "/one/three"

/* Adapters */
$posix = Paths::getAdapter('posix');
$win = Paths::getAdapter('windows');

$posix->isAbsolute('c:\config.sys'); // False
$win->isAbsolute('c:\config.sys'); // True

/* Objects */
$url = Paths::getAdapter('url')->create('http://site.loc/news/view.php?id=10');
$url->resolve('../index.html#footer'); // http://site.loc/index.html#footer

$url->params->fragment; // "footer"