druc / flysystem-incremental-naming
处理重复文件时,Flysystem 插件用于递增文件名
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-09-09 01:55:46 UTC
README
处理重复文件时,Flysystem 插件用于递增文件名
安装
通过 Composer
$ composer require druc/flysystem-incremental-naming
使用
<?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');
变更日志
请参阅 CHANGELOG 了解最近的变化。
测试
$ composer test
贡献
请参阅 CONTRIBUTING 和 CODE_OF_CONDUCT 了解详细信息。
安全
如果您发现任何安全问题,请通过电子邮件 druc@pinsmile.com 联系,而不是使用问题跟踪器。
鸣谢
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。