PHP code example of ali-eltaweel / files

1. Go to this page and download the library: Download ali-eltaweel/files library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ali-eltaweel / files example snippets


use Files\{ Directory, File, RegularFile };

$file = File::make('path/to/file');
$file = new RegularFile('path/to/file');

$dir = File::make('path/to/dir');
$dir = new Directory('path/to/dir');

copy(Path|string $target): bool

link(Path|string $target): bool

symlink(Path|string $target): bool

rename(Path|string $target): bool

touch(?int $mtime = null, ?int $atime = null): bool

remove(): bool

open(): Handles\Handle

transaction(callable $work, string $mode = 'r', Lock $lock = Lock::Exclusive): mixed

setContent(string $content): int

getContent(): ?string

mkdir(Path|string $name, int $permissions = 0777, bool $recursive = false): ?Directory

remove(bool $force = false): bool

foreachChild(callable $callback): void

chgrpTarget(string|int $group): bool

chownTarget(string|int $user): bool

readlink(): ?File

readlinkRecursively(): ?File