Neuron-PHP

RealFileSystem
in package
implements IFileSystem

Real file system implementation.

This is the production implementation that wraps PHP's native file system functions. Provides actual file system access for normal operations.

Table of Contents

Interfaces

IFileSystem
Interface for file system operations abstraction.

Methods

fileExists()  : bool
Check if a file exists
getcwd()  : string|false
Get current working directory
glob()  : array<string|int, mixed>|false
Find pathnames matching a pattern
isDir()  : bool
Check if path is a directory
mkdir()  : bool
Create a directory
readFile()  : string|false
Read entire file contents
realpath()  : string|false
Get absolute path (resolve symlinks, relative paths)
rmdir()  : bool
Remove a directory
scandir()  : array<string|int, mixed>|false
List files and directories in a directory
unlink()  : bool
Delete a file
writeFile()  : int|false
Write data to file

Methods

fileExists()

Check if a file exists

public fileExists(string $path) : bool
Parameters
$path : string

File path

Tags
inheritDoc
Return values
bool

True if file exists, false otherwise

getcwd()

Get current working directory

public getcwd() : string|false
Tags
inheritDoc
Return values
string|false

Current directory or false on failure

glob()

Find pathnames matching a pattern

public glob(string $pattern) : array<string|int, mixed>|false
Parameters
$pattern : string

Pattern to match (e.g., "/path/.txt", "/path/**​/.php")

Tags
inheritDoc
Return values
array<string|int, mixed>|false

Array of matching paths or false on failure

isDir()

Check if path is a directory

public isDir(string $path) : bool
Parameters
$path : string

Directory path

Tags
inheritDoc
Return values
bool

True if directory exists, false otherwise

mkdir()

Create a directory

public mkdir(string $path[, int $permissions = 0755 ][, bool $recursive = true ]) : bool
Parameters
$path : string

Directory path

$permissions : int = 0755

Directory permissions (default 0755)

$recursive : bool = true

Create parent directories if needed (default true)

Tags
inheritDoc
Return values
bool

True on success, false on failure

readFile()

Read entire file contents

public readFile(string $path) : string|false
Parameters
$path : string

File path

Tags
inheritDoc
Return values
string|false

File contents or false on failure

realpath()

Get absolute path (resolve symlinks, relative paths)

public realpath(string $path) : string|false
Parameters
$path : string

Path to resolve

Tags
inheritDoc
Return values
string|false

Resolved absolute path or false on failure

rmdir()

Remove a directory

public rmdir(string $path) : bool
Parameters
$path : string

Directory path

Tags
inheritDoc
Return values
bool

True on success, false on failure

scandir()

List files and directories in a directory

public scandir(string $path) : array<string|int, mixed>|false
Parameters
$path : string

Directory path

Tags
inheritDoc
Return values
array<string|int, mixed>|false

Array of filenames or false on failure

Delete a file

public unlink(string $path) : bool
Parameters
$path : string

File path

Tags
inheritDoc
Return values
bool

True on success, false on failure

writeFile()

Write data to file

public writeFile(string $path, string $data) : int|false
Parameters
$path : string

File path

$data : string

Data to write

Tags
inheritDoc
Return values
int|false

Number of bytes written or false on failure


        
On this page

Search results