halalsoft/laravel-google-cloud-storage 问题修复 & 功能扩展

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

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

halalsoft/laravel-google-cloud-storage

Composer 安装命令:

composer require halalsoft/laravel-google-cloud-storage

包简介

A Google Cloud Storage flysystem for Laravel

README 文档

README

A Google Cloud Storage filesystem for Laravel.

StyleCI Scrutinizer Code Quality Codacy Badge Code Intelligence Status Build Status GitHub repo size Software License GitHub top language Packagist Version Total Downloads

This is using flysystem-aws-s3-v3. Because Google Cloud Storage uses the same api as Amazon S3, so actually I just use the same driver but I renamed to gcs.

Installation

composer require halalsoft/laravel-google-cloud-storage

Add a new disk to your filesystems.php config

'gcs' => [
        'driver'   => 'gcs',
        'key'      => env('GCP_ACCESS_KEY_ID'),
        'secret'   => env('GCP_SECRET_ACCESS_KEY'),
        'bucket'   => env('GCP_BUCKET'),
],

Above is the config that required, here is other possible configs:

'gcs' => [
        'driver'   => 'gcs',
        'key'      => env('GCP_ACCESS_KEY_ID'),
        'secret'   => env('GCP_SECRET_ACCESS_KEY'),
        'bucket'   => env('GCP_BUCKET'),
        'visibility' => 'public', //Default visibility, you can set public or private
        'url'    => "https://custom.domain.com", //Your public URL (if you use custom domain or CDN)
        'endpoint' => "https://storage.googleapis.com", //Your endpoint URL (if you use custom driver)
        'cache' => [
            'store' => 'memcached',
            'expire' => 600,
            'prefix' => 'cache-prefix',
          ],
],

Usage

You can use most of Laravel Filesystem API

Examples:

$disk = Storage::disk('gcs');

// create a file
$disk->put('avatars/1', $request->file("image"));

// check if a file exists
$exists = $disk->exists('image.jpg');

// get file last modification date
$time = $disk->lastModified('image1.jpg');

// copy a file
$disk->copy('old/image1.jpg', 'new/image1.jpg');

// move a file
$disk->move('old/image1.jpg', 'new/image1.jpg');

// get url to file
$url = $disk->url('avatar/yaskur.jpg');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固