PHP code example of imran / file
1. Go to this page and download the library: Download imran/file 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/ */
imran / file example snippets
composer
$exists = File::exists('path/to/file');
$contents = File::get('path/to/file');
File::put('path/to/file', 'contents');
File::append('path/to/file', 'contents');
File::delete('path/to/file');
$isDirectory = File::isDirectory('path/to/directory');
File::makeDirectory('path/to/directory');
File::deleteDirectory('path/to/directory');
$contents = File::readDirectory('path/to/directory');
File::changeMode('path/to/file', 0777);
File::prepend('path/to/file', 'contents');
File::move('path/to/old/file', 'path/to/new/file');
File::link('path/to/target', 'path/to/link');
$name = File::name('path/to/file.ext');
$basename = File::basename('path/to/file.ext');
$dirname = File::dirname('path/to/file.ext');
$type = File::type('path/to/file');
$isReadable = File::isReadable('path/to/file');
$isWriteable = File::isWriteable('path/to/file');
$isFile = File::isFile('path/to/file');
$files = File::files('path/to/directory');
$allFiles = File::allFiles('path/to/directory');
File::moveDirectory('path/to/old/directory', 'path/to/new/directory');
File::copyDirectory('path/to/old/directory', 'path/to/new/directory');
File::cleanDirectory('path/to/directory');
$size = File::size('path/to/file');
$lastModified = File::lastModified('path/to/file');
$source = 'path/to/source';
$destination = 'path/to/destination';
File::copy($source,destination);
$source = 'path/to/source';
$destination = 'path/to/destination';
File::move($source,destination);
$extension = File::extension('path/to/file');
$mimeType = File::mimeType('path/to/file');
shell
.\vendor\bin\phpunit tests/FileTest.php