PHP code example of royalcms / temporary-directory
1. Go to this page and download the library: Download royalcms/temporary-directory 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/ */
royalcms / temporary-directory example snippets
use Spatie\TemporaryDirectory\TemporaryDirectory;
$temporaryDirectory = (new TemporaryDirectory())->create();
// Get a path inside the temporary directory
$temporaryDirectory->path('temporaryfile.txt');
// Delete the temporary directory and all the files inside it
$temporaryDirectory->delete();
(new TemporaryDirectory())->create();
(new TemporaryDirectory())
->name($name)
->create();
(new TemporaryDirectory())
->name($name)
->force()
->create();
(new TemporaryDirectory($location))
->create();
(new TemporaryDirectory())
->location($location)
->create();
$temporaryDirectory = (new TemporaryDirectory())->create();
$temporaryDirectory->path('dumps/datadump.dat'); // return /tmp/1485941876276/dumps/datadump.dat
$temporaryDirectory->clean();
$temporaryDirectory->delete();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.