fyre / path
A path utility library.
v2.0.11
2024-10-28 08:04 UTC
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.59
- fyre/php-cs-fixer-config: ^1.0
- phpunit/phpunit: ^11
README
FyrePath is a free, open-source path library for PHP.
Table Of Contents
Installation
Using Composer
composer require fyre/path
In PHP:
use Fyre\Utility\Path;
Methods
Base Name
Get the base name from a file path.
$path
is a string representing the file path.
$baseName = Path::baseName($path);
Dir Name
Get the directory name from a file path.
$path
is a string representing the file path.
$dirName = Path::dirName($path);
Extension
Get the file extension from a file path.
$path
is a string representing the file path.
$extension = Path::extension($path);
File Name
Get the file name from a file path.
$path
is a string representing the file path.
$fileName = Path::fileName($path);
Format
Format path info as a file path.
$pathInfo
is an array containing the path info.
$path = Path::format($pathInfo);
Is Absolute
Determine whether a file path is absolute.
$path
is a string representing the file path.
$isAbsolute = Path::isAbsolute($path);
Join
Join path segments.
All arguments supplied will be joined.
$path = Path::join(...$paths);
Normalize
Normalize a file path.
$path
is a string representing the file path.
$normalized = Path::normalize($path);
Parse
Parse a file path.
$path
is a string representing the file path.
$pathInfo = Path::parse($path);
Resolve
Resolve a file path from path segments.
All arguments supplied will be resolved.
$path = Path::resolve(...$paths);