ddruganov/php-transactional-filesystem
Composer 安装命令:
composer require ddruganov/php-transactional-filesystem
包简介
Perform transactional file operations just like you would with a database
README 文档
README
Virtual file system that applies changes to the real file system on commit
Installation
composer require ddruganov/php-transactional-filesystem
TODO:
- check permissions when creating files and folder in virtual filesystem
- record mode that files and folders are to be created with
How-to
$folder = '/opt/your-folder'; $file = "$folder/test.txt"; // work with a transaction $transactionalFileSystem = new TransactionalFileSystem(); $transactionalFileSystem->createFolder($folder); $transactionalFileSystem->writeFile($file, 'some string content'); $transactionalFileSystem->commit(); // check that files are actually created $realFileSystem = new RealFileSystem(); $realFileSystem->getFolderStatus($folder); // will be FileSystemUnitStatus::EXISTS $realFileSystem->getFileStatus($file); // will be FileSystemUnitStatus::EXISTS // delete the file $transactionalFileSystem = new TransactionalFileSystem(); $transactionalFileSystem->deleteFile($file); $transactionalFileSystem->commit(); // check that files are actually deleted $realFileSystem = new RealFileSystem(); $realFileSystem->getFolderStatus($folder); // will be FileSystemUnitStatus::EXISTS $realFileSystem->getFileStatus($file); // will be FileSystemUnitStatus::NOT_FOUND
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-05-04