/**
 * Get the trailing name component from a file path.
 *
 * @return string The trailing name of a given file.
 */
public function basename(): string

Examples

$result = $filesystem->file('/foo/1.txt')->basename();

echo $result;

The above example will output:

1.txt

Getting Started

Methods

Filesystem
File
Directory