PHP code example of cs278 / mktemp

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

    

cs278 / mktemp example snippets


  use function Cs278\Mktemp\temporaryFile;

  var_dump(temporaryFile());
  // /tmp/tmp.P9aLnd
  var_dump(temporaryFile('output.XXXX.pdf'));
  // /tmp/output.oI7b.pdf
  var_dump(temporaryFile(null, '/var/tmp'));
  // /var/tmp/tmp.8uJx
  var_dump(temporaryFile('test.XXX.html', '/var/tmp'));
  // /var/tmp/test.9h2.html
  

  use function Cs278\Mktemp\temporaryDir;

  var_dump(temporaryDir());
  // /tmp/tmp.P9aLnd
  var_dump(temporaryDir('output.XXXX.pdf'));
  // /tmp/output.oI7b.pdf
  var_dump(temporaryDir(null, '/var/tmp'));
  // /var/tmp/tmp.8uJx
  var_dump(temporaryDir('test.XXX.html', '/var/tmp'));
  // /var/tmp/test.9h2.html