PHP code example of task / archive
1. Go to this page and download the library: Download task/archive 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 / archive example snippets
use Task\Plugin\FilesystemPlugin;
use Task\Plugin\ArchivePlugin;
use Task\Plugin\Archive\Archive;
$project->inject(function ($container) {
$container['fs'] = new FilesystemPlugin;
$container['archive'] = new ArchivePlugin;
});
$project->addTask('archive', ['fs', 'archive', function ($fs, $archive) {
$source = 'path/to/directory';
$target = 'path/to/archive.tar.gz';
$fs->ls($source)
->pipe($archive->create(Archive::TAR, Archive::GZ))
->pipe($fs->touch($target));
}]);