LaravelPackages.net
Acme Inc.
Toggle sidebar
rabiloo/laravel-local-temporary-url

This package provides temporary url method for local filesystem driver

201
3
v1.1.1
About rabiloo/laravel-local-temporary-url

rabiloo/laravel-local-temporary-url is a Laravel package for this package provides temporary url method for local filesystem driver. It currently has 3 GitHub stars and 201 downloads on Packagist (latest version v1.1.1). Install it with composer require rabiloo/laravel-local-temporary-url. Discover more Laravel packages by rabiloo or browse all Laravel packages to compare alternatives.

Last updated

Laravel Local Temporary Url

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Provides temporaryUrl() method for local filesystem driver

Laravel Local Temporary Url

NOTE: Laravel 11 comes with native support for this feature. See https://laravel.com/docs/11.x/filesystem#temporary-urls This package provides the same feature for Laravel 9+ versions.

Installation

You can install the package via composer:

composer require rabiloo/laravel-local-temporary-url

Usage

Enable by config (See https://laravel.com/docs/11.x/filesystem#enabling-local-temporary-urls )

# config/filesystems.php

return [
    'disks' => [
        // 
        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
            'throw' => false,
            'serve' => true, // Enable file server, default URL is `/local/temp/{path}?expires=xxx&signature=xxx`
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',   // Enable file server with `visibility` = `public` 
            'throw' => false,
        ],

        // Custom local disk
        'local2' => [
            'driver' => 'local',
            'root' => storage_path('app/local2'),
            'throw' => false,
            'serve' => true,        // Enable file server
            'url' => 'local2/tmp',  // The URL will be `/local2/tmp/{path}?expires=xxx&signature=xxx`
        ],

        //...
    ],
];

Make temporary URL

use Illuminate\Support\Facades\Storage;

$url = Storage::disk('local')->temporaryUrl($path, now()->addSeconds(120));

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Star History Chart