denisyukphp / tmpfile-manager
Temp files manager.
4.0.4
2022-09-22 21:03 UTC
Requires
- php: ^8.0
- denisyukphp/tmpfile: ^3.0
- symfony/event-dispatcher: ^6.0
- symfony/filesystem: ^6.0
- symfony/finder: ^6.0
- symfony/process: ^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.10
- php-parallel-lint/php-console-highlighter: ^1.0
- php-parallel-lint/php-parallel-lint: ^1.3
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.17.0
- vimeo/psalm: ^4.26
README
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
- Default configuration
- Creating temp files
- Removing temp files
- Check unclosed resources
- Garbage collection
- Custom handlers
- Subscribe events
Read more about temp file on Habr.