Skip to content

Laravel Storage::temporaryUrl() throws This driver does not support creating temporary URLs although adapter supports temporaryUrl() #97

Description

@obrunsmann

Hi team, thanks for maintaining this package.

I believe there is an integration gap with newer Laravel versions (tested on Laravel 12.x):
Storage::disk('bunnycdn')->temporaryUrl(...) throws:

RuntimeException: This driver does not support creating temporary URLs.

Even though this package supports temporary URL generation via BunnyCDNAdapter::temporaryUrl(...).

Environment

  • PHP: 8.4.18
  • Laravel: 12.53.0
  • platformcommunity/flysystem-bunnycdn: ^3.0
  • Flysystem: v3 (via Laravel)

Current setup

Custom driver registration (as documented), including:

$adapter->setTokenAuthKey($config['token_auth_key']);
return new FilesystemAdapter(
    new Filesystem($adapter, $config),
    $adapter,
    $config
);

Disk config includes token_auth_key.

Reproduction

  1. Register bunnycdn disk via Storage::extend(...) (per README).
  2. Set valid Bunny credentials + token auth key.
  3. Call:
Storage::disk('bunnycdn')->temporaryUrl('path/to/file.pdf', now()->addHour());

Actual result

Laravel throws:

RuntimeException: This driver does not support creating temporary URLs.

Expected result

A signed Bunny temporary URL should be returned.

Technical note

Laravel’s Illuminate\Filesystem\FilesystemAdapter::temporaryUrl() currently checks for:

  • method_exists($this->adapter, 'getTemporaryUrl')
  • or a registered buildTemporaryUrlsUsing(...) callback.

Your adapter exposes temporaryUrl(...) (Flysystem interface), not getTemporaryUrl(...), so Laravel doesn’t detect support automatically.

Workaround on app side:

$filesystemAdapter->buildTemporaryUrlsUsing(
    fn (string $path, DateTimeInterface $expiration, array $options = []) =>
        $adapter->temporaryUrl($path, $expiration, new \League\Flysystem\Config($options))
);

Suggestion

Could the package optionally provide a Laravel-specific helper/driver registration path that sets buildTemporaryUrlsUsing(...) automatically?
That would align package behavior with the “temporary URLs supported” expectation for Laravel users.

Happy to provide a PR if you agree with this direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions