Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document make method #76

Merged
merged 1 commit into from
Oct 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 call the `location` method with a `$location` argument.

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