druc / flysystem-incremental-naming
Flysystem plugins to increment file names when dealing with duplicates
v0.0.1
2018-09-08 13:06 UTC
Requires
- php: >=5.6
- league/flysystem: ^1.0
Requires (Dev)
- phpunit/phpunit: ^5.7.10
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-10-09 02:16:03 UTC
README
Flysystem plugins to increment file names when dealing with duplicates
Install
Via Composer
$ composer require druc/flysystem-incremental-naming
Usage
<?php use Druc\Flysystem\IncrementalNaming\IncrementedCopy; use Druc\Flysystem\IncrementalNaming\IncrementedRename; use Druc\Flysystem\IncrementalNaming\IncrementedPath; use League\Flysystem\Adapter\Local; use League\Flysystem\Filesystem; include __DIR__ . '/vendor/autoload.php'; $adapter = new Local(__DIR__ . '/my-dir'); $this->filesystem = new Filesystem($adapter); $this->filesystem->addPlugin(new IncrementedCopy); $this->filesystem->addPlugin(new IncrementedRename); $this->filesystem->addPlugin(new IncrementedPath); $filesystem = new Filesystem($adapter); // Filenames will be incremented when copying/renaming into a directory containing the same filename $filesystem->incrementedCopy('mydir/file', 'other-dir/file'); // 'other-dir/file_1' $filesystem->incrementedRename('mydir/file', 'other-dir/file'); // 'other-dir/file_1' // This returns 'other-dir/file_2' if 'file' and 'file_1' are already present $filesystem->getIncrementedPath('other-dir/file');
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email druc@pinsmile.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.