PHP code example of davidpersson / temporary

1. Go to this page and download the library: Download davidpersson/temporary 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/ */

    

davidpersson / temporary example snippets




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`.