Skip to content

Commit

Permalink
Document make method
Browse files Browse the repository at this point in the history
  • Loading branch information
openjck committed Sep 30, 2023
1 parent bc35268 commit 61307aa
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 also call the `location` method with a `$location` argument.

```php
(new TemporaryDirectory())
Expand Down

0 comments on commit 61307aa

Please sign in to comment.