denisyukphp/tmpfile-manager

Temp files manager.

4.0.4 2022-09-22 21:03 UTC

This package is auto-updated.

Last update: 2024-04-27 21:26:50 UTC


README

Build Status Latest Stable Version Packagist PHP Version Support Total Downloads License

Temp files manager.

Installation

You can install the latest version via Composer:

composer require denisyukphp/tmpfile-manager

This package requires PHP 8.0 or later.

Quick usage

Configure TmpFileManager and create a temp file:

<?php

use TmpFileManager\Config\Config;
use TmpFileManager\TmpFileManager;
use TmpFile\TmpFileInterface;

$config = new Config(
    tmpFileDirectory: sys_get_temp_dir(),
    tmpFilePrefix: 'php',
);

$tmpFileManager = new TmpFileManager($config);

/** @var TmpFileInterface $tmpFile */
$tmpFile = $tmpFileManager->create();

All temp files which created with the manager will be purged automatically by default.

Documentation

Read more about temp file on Habr.