Method | Description | |
---|---|---|
canonicalize ( string $path ) : string | Canonicalizes the given path. | |
changeExtension ( string $path, string $extension ) : string | Changes the extension of a path string. | |
getDirectory ( string $path ) : string | Returns the directory part of the path. | |
getExtension ( string $path, boolean $forceLowerCase = false ) : string | Returns the extension from a file path. | |
getFilename ( string $path ) : string | Returns the file name from a file path. | |
getFilenameWithoutExtension ( string $path, string | null $extension = null ) : string | Returns the file name without the extension from a file path. | |
getHomeDirectory ( ) : string | Returns canonical path of the user's home directory. | |
getLongestCommonBasePath ( array $paths ) : string | null | Returns the longest common base path of a set of paths. | |
getRoot ( string $path ) : string | Returns the root directory of a path. | |
hasExtension ( string $path, string | array | null $extensions = null, boolean $ignoreCase = false ) : boolean | Returns whether the path has an extension. | |
isAbsolute ( string $path ) : boolean | Returns whether a path is absolute. | |
isBasePath ( string $basePath, string $ofPath ) : boolean | Returns whether a path is a base path of another path. | |
isLocal ( string $path ) : boolean | Returns whether the given path is on the local filesystem. | |
isRelative ( string $path ) : boolean | Returns whether a path is relative. | |
join ( string[] | string $paths ) : string | Joins two or more path strings. | |
makeAbsolute ( string $path, string $basePath ) : string | Turns a relative path into an absolute path. | |
makeRelative ( string $path, string $basePath ) : string | Turns a path into a relative path. | |
normalize ( string $path ) : string | Normalizes the given path. |
Method | Description | |
---|---|---|
__construct ( ) | ||
split ( string $path ) : string[] | Splits a part into its root directory and the remainder. | |
toLower ( string $str ) : string | Converts string to lower-case (multi-byte safe if mbstring is installed). |
public static canonicalize ( string $path ) : string | ||
$path | string | A path string. |
return | string | The canonical path. |
public static getDirectory ( string $path ) : string | ||
$path | string | A path string. |
return | string | The canonical directory part. Returns the root directory if the root directory is passed. Returns an empty string if a relative path is passed that contains no slashes. Returns an empty string if an empty string is passed. |
public static getExtension ( string $path, boolean $forceLowerCase = false ) : string | ||
$path | string | The path string. |
$forceLowerCase | boolean | Forces the extension to be lower-case (requires mbstring extension for correct multi-byte character handling in extension). |
return | string | The extension of the file path (without leading dot). |
public static getFilename ( string $path ) : string | ||
$path | string | The path string. |
return | string | The file name. |
public static getHomeDirectory ( ) : string | ||
return | string | The canonical home directory |
public static hasExtension ( string $path, string | array | null $extensions = null, boolean $ignoreCase = false ) : boolean | ||
$path | string | The path string. |
$extensions | string | array | null | If null or not provided, checks if an extension exists, otherwise checks for the specified extension or array of extensions (with or without leading dot). |
$ignoreCase | boolean | Whether to ignore case-sensitivity (requires mbstring extension for correct multi-byte character handling in the extension). |
return | boolean | Returns `true` if the path has an (or the specified) extension and `false` otherwise. |
public static isAbsolute ( string $path ) : boolean | ||
$path | string | A path string. |
return | boolean | Returns true if the path is absolute, false if it is relative or empty. |
public static isRelative ( string $path ) : boolean | ||
$path | string | A path string. |
return | boolean | Returns true if the path is relative or empty, false if it is absolute. |