PHP code example of danbettles / temper
1. Go to this page and download the library: Download danbettles/temper library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
danbettles / temper example snippets
$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
$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();