class File (View source)

Methods

static bool
strict(bool|null $enable = null)

Enables/disable case-sensitive file and directory existence checks performed by the framework in most methods of the File class. If disabled, case sensitivity is determined by the operating system or the underlying file system.

static bool
exists(string $path)

Checks whether a file or directory exists using case-sensitive path matching, helping developers maintain consistent behavior across Windows development environments and Unix-like production systems Note: File::exists() method is not affected by this configuration

static string|false
permissions(string $path, bool $full = false, bool $link = false)

Get file/directory permissions in a format more readable.

static bool
output(string $path, int $length = 0, int $delay = 0)

Show file in output, if use ob_start is auto used ob_flush

static string|false
portion(string $path, int $offset = 0, int $length = 1024)

Reads file into a string, starting at the specified offset up to length bytes Note: Same behavior as file_get_contents, but case-sensitive in development mode

static array|false
lines(string $path, int $offset = 0, int $length = 100)

Read lines from a file

static 
clearstat()

Clear state files and clear info files from permissions()

Details

static bool strict(bool|null $enable = null)

Enables/disable case-sensitive file and directory existence checks performed by the framework in most methods of the File class. If disabled, case sensitivity is determined by the operating system or the underlying file system.

Parameters

bool|null $enable

Return Value

bool

Exceptions

Exception

static bool exists(string $path)

Checks whether a file or directory exists using case-sensitive path matching, helping developers maintain consistent behavior across Windows development environments and Unix-like production systems Note: File::exists() method is not affected by this configuration

Parameters

string $path

Return Value

bool

static string|false permissions(string $path, bool $full = false, bool $link = false)

Get file/directory permissions in a format more readable.

Return false if file is not found

Parameters

string $path

File path

bool $full

If true, it returns the full format; otherwise, it returns the octal format.

bool $link

If true, it indicates that it should return the permissions of a symbolic link and not the source.

Return Value

string|false

Exceptions

Exception

static bool output(string $path, int $length = 0, int $delay = 0)

Show file in output, if use ob_start is auto used ob_flush

Parameters

string $path

File path

int $length

Up to length number of bytes read

int $delay

Sets the interval between each reading

Return Value

bool

Exceptions

Exception

static string|false portion(string $path, int $offset = 0, int $length = 1024)

Reads file into a string, starting at the specified offset up to length bytes Note: Same behavior as file_get_contents, but case-sensitive in development mode

Parameters

string $path

File path

int $offset

The offset where the reading starts on the original stream (Negative offsets count from the end of the stream)

int $length

Maximum length of data read.

Return Value

string|false

Exceptions

Exception

static array|false lines(string $path, int $offset = 0, int $length = 100)

Read lines from a file

Parameters

string $path

File path

int $offset

Number of rows to skip (0 disables skips)

int $length

Maximum number of lines read (0 disables line limits)

Return Value

array|false

Exceptions

Exception

static clearstat()

Clear state files and clear info files from permissions()