This is a Flysystem Adapter to move files into garbage folder when specific actions are taken
composer require tinect/flysystem-garbage
<?php
declare(strict_types=1);
use League\Flysystem\Filesystem;
use League\Flysystem\Config;
use League\Flysystem\Local\LocalFilesystemAdapter;
use Tinect\Flysystem\Garbage\GarbageAdapter;
//Initialize your adapter
$adapter = new LocalFilesystemAdapter(
'/my/path/'
);
//Put your adapter into the garbageAdapter
$adapter = new GarbageAdapter(
$adapter
);
//Perform your actions as usual
$adapter->write('test.txt', 'content', new Config());
$adapter->delete('test.txt');
//see directory "garbage"