Skip to main content
Timber

You are reading the documentation for Timber v2.x. Switch to the documentation for Timber v1.x.

Timber\​PathHelper

Useful methods for working with file paths.

Overview #

Methods #

NameReturn TypeSummary/Returns
basename()stringReturns trailing name component of path.
pathinfo()mixedReturns information about a file path.

Class Methods #

basename() #

Returns trailing name component of path.

Unicode-friendly version of the PHP basename() function.

link https://www.php.net/manual/en/function.basename.php

since 1.11.1

basename( string $path, string $suffix = '' )

Returns: string

NameTypeDescription
$pathstringThe path.
$suffixstringOptional. If the name component ends in suffix, this part will also be cut off.

pathinfo() #

Returns information about a file path.

Unicode-friendly version of PHP’s pathinfo() function.

link https://www.php.net/manual/en/function.pathinfo.php

since 1.11.1

pathinfo( string $path, int $options = PATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME )

Returns: mixed

NameTypeDescription
$pathstringThe path to be parsed.
$optionsintThe path part to extract. One of PATHINFO_DIRNAME, PATHINFO_BASENAME, PATHINFO_EXTENSION or PATHINFO_FILENAME. If not specified, returns all available elements.