定制 lipit146/filesystem-sirv 二次开发

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

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

lipit146/filesystem-sirv

最新稳定版本:1.0.1

Composer 安装命令:

composer require lipit146/filesystem-sirv

包简介

A Laravel filesystem driver for Sirv Images

README 文档

README

This package provides a filesystem driver for Sirv Images. If you need more control or want to want to implement more Sirv API endpoints have a look at our Laravel wrapper for Sirv which is also used by this packages.

The full documentation of the Sirv Images API can be found here.

Requirements

  • PHP >= 8.0
  • Laravel >= 9.0

Installation

To start using the package, you need to install it via Composer:

composer require lipit146/filesystem-sirv

Laravel version compatibility

Laravel version Laravel Cloudflare version
8.x 1.x

Service Provider

Add the package service provider in your config/app.php

'providers' => [
    // ...
    Lipit146\FilesystemSirv\FilesystemSirvImagesServiceProvider::class,
];

Publish package assets

Publish the package asset files using this php artisan command

$ php artisan vendor:publish --provider="Lipit146\FilesystemSirv\FilesystemSirvImagesServiceProvider"

Confuguration

Add the following to your config/filesystems.php file:

'sirv' => [
    'driver' => 'sirv',
    'key' => env('SIRV_ACCESS_KEY_ID'),
    'secret' => env('SIRV_SECRET_ACCESS_KEY'),
    'region' => env('SIRV_DEFAULT_REGION'),
    'bucket' => env('SIRV_BUCKET'),
    'url' => env('SIRV_URL'),
    'endpoint' => env('SIRV_ENDPOINT'),
    'scheme'  => 'https',
],

Add the following environment variables to your .env file:

SIRV_ACCESS_KEY_ID="<your_email>"
SIRV_SECRET_ACCESS_KEY="<your_access_key>"
SIRV_DEFAULT_REGION="<option_region>"
SIRV_BUCKET="<your_bucket>"
SIRV_ENDPOINT="https://s3.sirv.com"
SIRV_URL="https://<your_bucket>.sirv.com"

If you did not have our Laravel-Sirv wrapper yet you also need to add the following environment variables to your .env file:

SIRV_ACCESS_KEY_ID=""
SIRV_SECRET_ACCESS_KEY=""
SIRV_BUCKET=""

Getting started

The Sirv Images filesystem driver can be used as you would use another filesystem driver. The documentation for the Laravel filesystem can be found here.

The following example shows how to use the Sirv Images filesystem driver to store a file.

use Illuminate\Support\Facades\Storage;

Storage::disk('sirv')->put('example.png', 'contents');

Notes

Sirv Images doesnot support directories so not all filesystem methods are available. The following methods are supported:

  • get
  • put
  • delete
  • directories

The following methods are not supported:

  • files
  • allFiles
  • allDirectories
  • createDirectory
  • deleteDirectory
  • fileExists
  • url
  • copy
  • rename
  • visibility

The following methods still need to be implemented:

  • setVisibility
  • getVisibility

Security Vulnerabilities

If you discover a security vulnerability within this project, please email me via songviytuong@gmail.com.

Official Website

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-19