定制 reusser/laravel-cloudflare-r2 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

reusser/laravel-cloudflare-r2

最新稳定版本:1.0.1

Composer 安装命令:

composer require reusser/laravel-cloudflare-r2

包简介

Cloudflare R2 integration for Laravel's Storage API

README 文档

README

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

Cloudflare R2 integration for Laravel's Storage API

Installation

You can install the package via composer:

composer require reusser/laravel-cloudflare-r2

Option 1: Use a new Disk

Add this to the disks section of config/filesystems.php:

        'r2' => [
            'driver' => 'r2',
            'key' => env('R2_ACCESS_KEY_ID'),
            'secret' => env('R2_SECRET_ACCESS_KEY'),
            'region' => env('R2_DEFAULT_REGION', 'us-east-1'),
            'bucket' => env('R2_BUCKET'),
            'url' => env('R2_URL'),
            'endpoint' => env('R2_ENDPOINT', false),
            'use_path_style_endpoint' => env('R2_USE_PATH_STYLE_ENDPOINT', false),
            'throw' => false,
        ],

And fill out these in your .env:

R2_URL=https://some-worker.randomid.workers.dev
R2_ENDPOINT=https://randomid.r2.cloudflarestorage.com
R2_ACCESS_KEY_ID=random-key
R2_SECRET_ACCESS_KEY=random-secret
R2_BUCKET=bucket
R2_DEFAULT_REGION=us-east-1
R2_USE_PATH_STYLE_ENDPOINT=false

Option 2: Use S3 Disk

Change your s3 disk to the R2 driver in config/filesystems.php:

        's3' => [
            'driver' => 'r2',
            ...

And fill out these in your .env:

AWS_URL=https://some-worker.randomid.workers.dev
AWS_ENDPOINT=https://random-id.r2.cloudflarestorage.com
AWS_ACCESS_KEY_ID=random-key
AWS_SECRET_ACCESS_KEY=random-secret
AWS_BUCKET=some-bucket
AWS_DEFAULT_REGION=us-east-1
AWS_USE_PATH_STYLE_ENDPOINT=false

FAQ

Is this package really necessary?

No, you can use the s3 driver with Cloudflare R2, but this package makes it easier to use. Just be sure to set 'retain_visibility' => false, in your standard s3 configuration to prevent incompatibility issues.

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.

统计信息

  • 总下载量: 3.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-18