Helper Functions#
Global helper functions are autoloaded from src/functions.php.
Available helpers (brief):
getHumanReadableFileSize(int $bytes): stringisDirectoryEmpty(string $directoryPath): booldeleteDirectory(string $directoryPath): boolgetDirectorySize(string $directoryPath): intcreateDirectory(string $directoryPath, int $permissions = 0755): boollistFiles(string $directoryPath): arraycopyDirectory(string $source, string $destination): boolcreateFilesystem(array $config): FilesystemOperatormountStorage(string $name, array $config): FilesystemOperatormountStorages(array $mounts): void
Notes:
Helpers are Flysystem-aware and can work with mounted scheme paths.
They keep return types small and script-friendly for utility usage.
Example#
createDirectory('/tmp/demo');
file_put_contents('/tmp/demo/a.txt', 'data');
$size = getDirectorySize('/tmp/demo');
$files = listFiles('/tmp/demo');
Storage setup helper example:
mountStorage('assets', [
'driver' => 'local',
'root' => '/srv/storage/assets',
]);