1. Go to this page and download the library: Download crysalead/dir 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/ */
crysalead / dir example snippets
$files = Dir::scan('my/dir', // Can be a string path of an array of string paths
[
'// Can be an array of types, possible values:
// `'file'`, `'dir'`, `'executable'`, `'link'`, `'readable'`, `'writable'`
'skipDots' => true, // Keeps '.' and '..' directories in result
'leavesOnly' => true, // Keeps only leaves
'followSymlinks' => true, // Follows Symlinks
'recursive' => true // Scans recursively,
'copyHandler' => function($path, $target) { // The copy handler
copy($path, $target);
}
]
);
$files = Dir::copy('my/dir', // A string path of an array of string paths
'my/destination', // A destination path (string only)
[
'mode' => 0755, // Mode used for directory creation
'childrenOnly' => false, // Copies the file inside 'my/dir' if `true`, otherwise `dir` will be
// added as the root directory.
'followSymlinks' => true, // Follows Symlinks
'recursive' => true // Scans recursively
]
);
Dir::remove('my/dir', // Can be a string path of an array of string paths
[
'followSymlinks' => false, // Follows Symlinks
'recursive' => true, // Scans recursively
'
$success = Dir::make('my/dir', // Can be a string path of an array of string paths
[
'mode' => 0755, // Mode used for directory creation
'recursive' => true, // Scans recursively
'
$dir = Dir::tempnam(sys_get_temp_dir(), 'mytmp');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.