abrardev/laravel-local-temporary-url 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

abrardev/laravel-local-temporary-url

最新稳定版本:v1.1.1

Composer 安装命令:

composer require abrardev/laravel-local-temporary-url

包简介

Quickly add support for temporary url for local filesystem drivers

README 文档

README

Caution

This package has abounded in favor of Laravel 11 official support for temporary urls https://laravel.com/docs/11.x/filesystem#temporary-urls. However, you can still use this package in Laravel 10 and below.

Logo

Installation

You can install the package via composer:

composer require abrardev/laravel-local-temporary-url

You can publish the config file with:

php artisan vendor:publish --tag="local-temporary-url-config"

This is the contents of the published config file:

return [
    'disk' => ['local'],

    'middleware' => ['web', 'signed']
];

Usage

Configuration

This package needs zero configuration, just install and it's good to go. However, if your local disk is different or you want to add another disk, you can configure it. You can add multiple local disks in the config using the disk key.

The package applies web and signed middleware on routes by default, however, you can configure middleware(s) using the middleware key.

Generate Temporary URL

You can use the same syntax used for S3 disk.

Storage::disk('local')->temporaryUrl('file.txt', now()->addMinutes(5));

Pass Parameters

You can pass parameters to the temporaryUrl function for ef filename.

Storage::disk('local')->temporaryUrl('file.txt', now()->addMinutes(5), ['filename' => 'customname']);

Not just file name, you can pass other options as well (with respect to disk)

[
  'ResponseContentType' => 'application/octet-stream',
  'ResponseContentDisposition' => 'attachment; filename=file2.jpg',
]

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.

统计信息

  • 总下载量: 19.74k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 20
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 20
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-03