class Storage (View source)

Methods

static string
path(string $path)

Get the path to a file or directory from the application's storage directory

static bool
mkdir(string $path, int|null $permissions = null)

Create the directory in storage recursively if it does not exist.

static bool
modified(string $path, DateTime $datetime)

Set the modified time of a file located in the storage directory, preserving the access time.

static bool
access(string $path, DateTime $datetime)

Set the access time of a file located in the storage directory, preserving the modification time.

static string
temp($prefix = '~')

Create temporary file and return path.

static int
clear($path, DateTime $expiresAt, int $attempts = 100, callable $filter = null)

Clear contents of storage application directory after specified expires date (or UNIX time), and returns number of deleted files

Details

static string path(string $path)

Get the path to a file or directory from the application's storage directory

Parameters

string $path

Return Value

string

Exceptions

Exception

static bool mkdir(string $path, int|null $permissions = null)

Create the directory in storage recursively if it does not exist.

Note: If the permission is not defined, the permission of the system/storage directory will be used.

Parameters

string $path
int|null $permissions

Return Value

bool

Exceptions

Exception

static bool modified(string $path, DateTime $datetime)

Set the modified time of a file located in the storage directory, preserving the access time.

Parameters

string $path
DateTime $datetime

Return Value

bool

Exceptions

Exception

static bool access(string $path, DateTime $datetime)

Set the access time of a file located in the storage directory, preserving the modification time.

Parameters

string $path
DateTime $datetime

Return Value

bool

Exceptions

Exception

static string temp($prefix = '~')

Create temporary file and return path.

Parameters

$prefix

Return Value

string

Exceptions

Exception

static int clear($path, DateTime $expiresAt, int $attempts = 100, callable $filter = null)

Clear contents of storage application directory after specified expires date (or UNIX time), and returns number of deleted files

Parameters

$path
DateTime $expiresAt
int $attempts
callable $filter

Return Value

int

Exceptions

Exception