davidpersson/temporary

Small PHP utility class to manage temporary files.

Installs: 2 875

Dependents: 3

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

pkg:composer/davidpersson/temporary

v1.0.2 2016-09-26 09:20 UTC

This package is not auto-updated.

Last update: 2025-10-11 21:07:07 UTC


README

Temporary
-- Small utility class to manage temporary files.

Synopsis
--------
n/a

Usage
-----
<?php

require '/path/to/temporary/bootstrap.php';

use temporary\Manager as Temporary;

// Note: directory paths dependent on your
// system's default temporary directory.

Temporary::file();
// returns /tmp/5228875718a8c

Temporary::file(['context' => 'transcode']);
// returns /tmp/transcode_522886bf315ca

Temporary::file(['context' => 'transcode', 'extension' => 'mp4']);
// returns /tmp/transcode_52288708bb5c6.mp4

Temporary::file(['clean' => false]);
// returns /tmp/522887b919ca6

// After shutdown the class will automatically cleanup any files
// that have been created without the clean option set to `false`.

?>

Copyright & License
-------------------
Temporary is Copyright (c) 2013 David Persson if not otherwise stated. The
code is distributed under the terms of the BSD 3-clause License. For the
full license text see the LICENSE file.