Getting File Information - machitgarha/JsonFile GitHub Wiki

Sometimes, you want to get file information. There are some methods that can help you to do that.

Getting file's name

You can easily get the file's name, without getting the path that the file exist inside it. For example, if you opened a file in ../../data/users.json, the following method will give you users.json only, not the whole path (thanks to this utility):

$jsonFile->getFilename();

Getting file's path

You can also get the file path in a clear format:

$jsonFile->getFilePath(); // E.g., "composer.json"