danbettles/temper
最新稳定版本:v3.0.0
Composer 安装命令:
composer require danbettles/temper
包简介
Tame your temp-files. Temper offers a smoother approach to working with temp-files in PHP.
README 文档
README
Temper offers a smoother approach to working with temp-files in PHP.
Usage
There are two ways to use it:
- 'Consume' a temp-file: create, use, and remove a temp-file in a single operation
- Create and remove temp-files in separate steps
Consume a Temp-File
$temper = new Temper('/path/to/tmp/dir'); $temper->consumeFile(function (SplFileInfo $tempFileinfo): void { // Do something with temp-file }); // Temp-file gone $temper->consumeFile(function (SplFileInfo $tempFileinfo): void { // Do something with `.jpg` temp-file }, 'jpg'); // Temp-file gone
Create and Remove In Separate Steps
Note
Since, at the end of its life, a Temper instance will automatically clean-up any remaining temp-files it knows about, you may never need to call cleanUp() by hand
$temper = new Temper('/path/to/tmp/dir'); $tempFileWithoutExtension = $temper->createFile(); $tempImageFile = $temper->createFile('jpg'); // Removes *all* remaining temp-files created by the Temper instance $temper->cleanUp();
Installation
Install using Composer:
composer require danbettles/temper
统计信息
- 总下载量: 100
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: ISC
- 更新时间: 2022-11-08