davidpersson/temporary

Small PHP utility class to manage temporary files.

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

This package is not auto-updated.

Last update: 2024-04-13 13:20:18 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.