Folder::jsonSerialize()

Returns the data to be serialized as JSON.

Table of Contents
  1. Description
  2. Example

Description

Folder::jsonSerialize(): mixed;

This method is a requirement to be able to implement the JsonSerializable interface and aims to make the data convertable to JSON. You won’t use this method directly, the json_encode() function will call this method automatically.

Example

$folder = new Folder('.\path\to\folder');

$test = json_encode($folder); // Returns `".\path\to\folder"` if folder exists, returns `false` if folder does not exist.

Folder::jsonSerialize()

Returns the data to be serialized as JSON.

Folder::size()

Gets the total sizes of files contained in the folder in human readable string format.