1. Go to this page and download the library: Download task/filesystem 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/ */
task / filesystem example snippets
use Task\Plugin\FilesystemPlugin;
use Symfony\Component\Finder\Finder;
$project->inject(function ($container) {
$container['fs'] = new FilesystemPlugin;
});
$project->addTask('write', ['fs', function ($fs) {
$fs->open('/tmp/foo')->write('wow');
}]);
$project->addTask('read', ['fs', function ($fs) {
$fs->read('/tmp/foo')->pipe($this->getOutput());
}]);
$project->addTask('copy', ['fs', function ($fs) {
$fs->copy('/tmp/foo', '/tmp/bar');
# OR
$fs->read('/tmp/foo')->pipe($fs->touch('/tmp/bar'));
}]);
$project->addTask('copyTree', ['fs', function ($fs) {
$finder = new Finder;
$finder->name('foo')->in('/tmp/source');
$fs->copyTree('/tmp'source', '/tmp/target', $finder);
}]);
use Task\Plugin\FilesystemPlugin;
$fs = new FilesystemPlugin;
use Task\Plugin\FilesystemPlugin;
use Symfony\Component\Finder\Finder;
$finder = new Finder;
$finder->ignoreVcs()->in('foo');
$fs = new FilesystemPlugin;
# @return FilesystemIterator('wow')
$fs->mirror('foo', 'wow', $finder);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.