Skip to content

denisyukphp/tmpfile-manager

This branch is 1 commit behind master.

Folders and files

NameName
Last commit message
Last commit date
Sep 10, 2023
Sep 13, 2022
Jun 27, 2024
Nov 19, 2024
May 16, 2024
Sep 13, 2022
Nov 19, 2024
Sep 13, 2022
Mar 30, 2023
Sep 4, 2023
Sep 4, 2023
Sep 4, 2023
May 16, 2024
Sep 4, 2023
Mar 30, 2023
Mar 30, 2023
Mar 30, 2023

Repository files navigation

TmpFileManager

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

Temp file 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

Build a temp file manager and create a temp file:

<?php

use TmpFileManager\TmpFileManagerBuilder;
use TmpFile\TmpFileInterface;

$tmpFileManager = (new TmpFileManagerBuilder())
    ->withTmpFileDir(sys_get_temp_dir())
    ->withTmpFilePrefix('php')
    ->build()
;

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

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

Documentation

Read more about temp file on Habr.