dmromanov/cakephp-tmpfile

Temporary file plugin for CakePHP.

Installs: 134

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:cakephp-plugin

1.1.0 2021-10-10 17:29 UTC

This package is auto-updated.

Last update: 2024-05-10 23:24:56 UTC


README

Latest Stable Version Minimum PHP Version Build Status codecov

This plugins provides class for creating temporary files, that are guaranteed to be deleted after program termination, and is compatible with CakePHP\Filesystem\File API.

Usage

Create unique temporary files:

$tmpFile1 = new TmpFile();
$tmpFile2 = new TmpFile(
    'foo-',
    TMP . 'bar',
    0644
)
$tmpFile2->close();

// use as a regular CakePHP\Filesystem\File
$tmpfile->open()
$tmpfile->write($data);
$tmpfile->close();

After a program termination (regular or after a crash) the file will be deleted.

Constructor's parameters:

string $prefix The prefix of the generated temporary filename.
string $path The directory where the temporary filename will be created
int $mode File permissions

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require dmromanov/cakephp-tmpfile