Bridge with league/flysystem
Refer to the official documentation on The League of Extraordinary Packages’s website.
This bridge provides multiple filesystem manipulations to read/write files from any storage.
Copy files job
This job will copy one or multiple files from a filesystem to another.
It must be provided with a
JobParameterAccessorInterface which will be used to fetch the list of files to copy.<?php
declare(strict_types=1);
use League\Flysystem\FilesystemReader;
use League\Flysystem\FilesystemWriter;
use Yokai\Batch\Bridge\League\Flysystem\Job\CopyFilesJob;
use Yokai\Batch\Job\Parameters\StaticValueParameterAccessor;
/** @var FilesystemReader $sourceFilesystem */
/** @var FilesystemWriter $destinationFilesystem */
new CopyFilesJob(
location: new StaticValueParameterAccessor('users.jsonl'),
source: $sourceFilesystem,
destination: $destinationFilesystem,
transformLocation: null, // a closure you can use to transform file name on destination filesystem
);
Move files job
This job will move one or multiple files from a filesystem to another.
It must be provided with a
JobParameterAccessorInterface which will be used to fetch the list of files to move.<?php
declare(strict_types=1);
use League\Flysystem\FilesystemReader;
use League\Flysystem\FilesystemWriter;
use Yokai\Batch\Bridge\League\Flysystem\Job\MoveFilesJob;
use Yokai\Batch\Job\Parameters\StaticValueParameterAccessor;
/** @var FilesystemReader $sourceFilesystem */
/** @var FilesystemWriter $destinationFilesystem */
new MoveFilesJob(
location: new StaticValueParameterAccessor('users.jsonl'),
source: $sourceFilesystem,
destination: $destinationFilesystem,
transformLocation: null, // a closure you can use to transform file name on destination filesystem
);