kiryi / pathyi
Simple path formatter.
Installs: 70
Dependents: 5
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/kiryi/pathyi
Requires
- php: ^7.4
This package is auto-updated.
Last update: 2025-09-24 11:54:28 UTC
README
A simple path formatter.
Installation
composer require kiryi/pathyi
Usage
$pathyi = new \Kiryi\Pathyi\Formatter(); $path = $pathyi->format($path);
Method Definition format
format(string $path, bool $leadingSlash = false, bool $trailingSlash = false): string
Parameters
path
The path to format. If only backslashes appearing, path will be returned with leading/trailing backslashes. If not, forward slashes are used.
leadingSlash
Defines if the returned path starts with a slash (true) or not (false, default).
trailingSlash
Defines if the returned path ends with a slash (true) or not (false, default).
Return Values
Returns the formatted path as a string.
Example
$path = '/this/is/my/path'; $pathyi = new \Kiryi\Pathyi\Formatter(); $path = $pathyi->format($path); // $path is now 'this/is/my/path' $path = $pathyi->format($path, true); // $path is now '/this/is/my/path' $path = $pathyi->format($path, false, true); // $path is now 'this/is/my/path/'