Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Developer654079525's avatar

The lifetime of a runtime storage disk

What is the lifetime of a storage disk created during runtime with:

$disk = Storage::build([
    'driver' => 'local',
    'root' => '/path/to/root',
]);
$disk->put('test.txt);
0 likes
3 replies
Glukinho's avatar
Level 31

It lives only inside of current request.

If it is HTTP request, it lives until the response is sent (strictly saying, and deferred actions is done, and terminable middleware is executed). If it is artisan command, it lives until the command is finished, etc.

1 like
Snapey's avatar

but the files and folders are left on the filesystem. Its not like a temporary filesystem.

1 like

Please or to participate in this conversation.