diff --git a/src/MountManager.php b/src/MountManager.php index ee7d37c16..bf1ec0945 100644 --- a/src/MountManager.php +++ b/src/MountManager.php @@ -4,6 +4,7 @@ namespace League\Flysystem; +use DateTimeInterface; use Throwable; use function method_exists; @@ -263,6 +264,18 @@ public function publicUrl(string $path, array $config = []): string return $filesystem->publicUrl($path, $config); } + public function temporaryUrl(string $path, DateTimeInterface $expiresAt, array $config = []): string + { + /** @var FilesystemOperator $filesystem */ + [$filesystem, $path] = $this->determineFilesystemAndPath($path); + + if ( ! method_exists($filesystem, 'temporaryUrl')) { + throw new UnableToGenerateTemporaryUrl(sprintf('%s does not support generating public urls.', $filesystem::class), $path); + } + + return $filesystem->temporaryUrl($path, $expiresAt, $config); + } + public function checksum(string $path, array $config = []): string { /** @var FilesystemOperator $filesystem */