Skip to content

oxSteven/pathyi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kiryi's PATHYI

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/'

About

A simple path formatter.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages