Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

spatie/temporary-directory 2.2.1

Easily create, use and destroy temporary directories
Package summary
Share
0
issues
0
licenses
Package created
31 Jan 2017
Version published
25 Dec 2023
Maintainers
1
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does spatie/temporary-directory do?

The Spatie's Temporary Directory, aka spatie/temporary-directory, is a PHP package designed to efficiently create, utilize, and delete temporary directories. The package allows developers to rapidly create a temporary directory within the system's temporary directory, perform required actions, and then seamlessly delete the directory and all contended files.

How do you use spatie/temporary-directory?

The Spatie Temporary Directory package is quite straightforward to use. First, install the package with Composer using the command composer require spatie/temporary-directory. Here are a few usage examples:

Creating a temporary directory:

use Spatie\TemporaryDirectory\TemporaryDirectory;
$temporaryDirectory = (new TemporaryDirectory())->create();

Customizing the directory name:

$temporaryDirectory = (new TemporaryDirectory())->name($name)->create();

Forcefully create a directory, even if a directory with the same name exists:

$temporaryDirectory = (new TemporaryDirectory())->name($name)->force()->create();

Create a directory at a custom location:

$temporaryDirectory = (new TemporaryDirectory($location))->create();

or

$temporaryDirectory = (new TemporaryDirectory())->location($location)->create();

Determine paths within the temporary directory:

$temporaryDirectory = (new TemporaryDirectory())->create();
$temporaryPath = $temporaryDirectory->path('dumps/datadump.dat'); 

Clear all files in a temporary directory:

$temporaryDirectory->empty();

Deleting the entire temporary directory:

$temporaryDirectory->delete();

Where are the spatie/temporary-directory docs?

The documentation detailing the detailed usage and methods of the Spatie Temporary Directory package is present in the README file on the package's GitHub repository. For additional details like security vulnerabilities, changes made in recent versions, and contribution guidelines, you can refer to the respective sections in the README or navigate to the respective linked pages.