From eb053edffc0d01be50e8957b1cbfdc27803d956c Mon Sep 17 00:00:00 2001 From: John Karahalis Date: Fri, 29 Sep 2023 21:50:27 -0400 Subject: [PATCH] Document make method --- README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4a0e297..1609506 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,20 @@ composer require spatie/temporary-directory ### Creating a temporary directory -To create a temporary directory simply call the `create` method on a `TemporaryDirectory` object. By default the temporary directory will be created in a timestamped directory in your system's temporary directory (usually `/tmp`). +To create a temporary directory simply call the `create` method on a `TemporaryDirectory` object. ```php (new TemporaryDirectory())->create(); ``` +Alternatively, use the static `make` method on a `TemporaryDirectory` object. + +```php +TemporaryDirectory::make(); +``` + +By default, the temporary directory will be created in a timestamped directory in your system's temporary directory (usually `/tmp`). + ### Naming your temporary directory If you want to use a custom name for your temporary directory instead of the timestamp call the `name` method with a string `$name` argument before the `create` method. @@ -75,7 +83,13 @@ You can set a custom location in which your temporary directory will be created ->create(); ``` -Optionally you can call the `location` method with a `$location` argument. +The `make` method also accepts a `$location` argument. + +```php +TemporaryDirectory::make($location); +``` + +Finally, you can call the `location` method with a `$location` argument. ```php (new TemporaryDirectory())