donut / path
utilities for handling and transforming file paths
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 49 323
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Open Issues: 1
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.2.2
This package is not auto-updated.
Last update: 2021-01-04 08:07:08 UTC
README
Utilities for handling and transforming file paths.
The file system is not checked to verify whether paths are valid.
Installation
path lives on packagist.org
$ composer require donut/path
Usage
<?php require "vendor/autoload.php"; use \Donut\Path as p; $path = p\join("/usr/local", "bin", "/donut"); // /usr/local/bin/donut
API
string canonicalize( string $path
[, string $root
= getcwd() ] )
<?php chdir("/home/donut"); canonicalize("a/b/c.ext"); // => /home/donut/a/b/c.ext canonicalize("a/b/c.ext", "/root"); // => /root/a/b/c.ext canonicalize("/home/donut/club.ext", "/root"); // => /home/donut/club.ext
bool is_absolute( string $path
)
<?php is_absolute("/home/donut"); // => true
string normalize( string $path
)
<?php normalize("/a/b/../c/./d.ext"); // => /a/c/d.ext
string join( string $part1
[, string $...
] )
<?php join("/usr", "local", "/bin", "./donut"); // => /usr/local/bin/donut
Attribution
- duchess code@donut.club
- Donut® Club http://github.com/donutclub
License
BSD 3-Clause