1. Go to this page and download the library: Download lukaswhite/directory 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/ */
lukaswhite / directory example snippets
$directory = new Directory( '/path/to/dir' );
if ( $directory->exists ) {
// do something
}
if ( ! $directory->isDirectory( ) ) {
// looks like it's a file!
}
$directory = new Directory( '/path/to/new/directory' );
$directory->create( );
$directory->create( 0755 );
$files = $directory->getFiles( );
$files = $directory->getFiles( true );
$files = $directory->getFiles( false, true );
$textFiles = $directory->glob( '*.txt' );
if ( $directory->fileExists( 'logo.png' ) ) {
// do something
}