承接 tbcd/file-archiver 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tbcd/file-archiver

Composer 安装命令:

composer require tbcd/file-archiver

包简介

A library to manage files archiving as well as their rotation

README 文档

README

FileArchiver is a library to manage files archiving as well as their rotation and their recovery

Table of content

Archivage

Let's suppose we have a file named demo.txt which we want to archive for 14 days

$fileArchiver = new FileArchiver();

...

$filePath = './demo.txt';
$archivedFile = $fileArchiver->archive($filePath, new DateInterval('P14D'));

And that's it. Your file is archived in the default storage directory __DIR__ but you can specify another location is you want

$fileArchiver = new FileArchiver('/my/storage/directory');

If you are using Symfony, the default storage location is %kernel.project_dir%/var/archive/

Suppression and rotation

The archive rotation is proceeded each time you archive a file with the same mask.

For exemple let's imagine we archived our file demo.txt 2 hours ago for a duration of 1 jour. When we will archive our new file, the previous archived will be deleted because he overlaps his archive duration.

You can anyway clear the archived files the way you want by calling the clear method

// This will clear all files having an expired archive duration
$fileArchiver->clear();

// This will clear all files archived before the passed date
// In the exemple below it will clear all archived files
$fileArchiver->clear(new DateTime());

Recovery

You can recover archived files as below and obtain the list of archived files with the given mask

$archivedFilesPath = $fileArchiver->find('demo');

统计信息

  • 总下载量: 76
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固