galihlprakoso/flysystem-firebase-storage 问题修复 & 功能扩展

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

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

galihlprakoso/flysystem-firebase-storage

最新稳定版本:v1.0.3

Composer 安装命令:

composer require galihlprakoso/flysystem-firebase-storage

包简介

FlySystem Firebase Storage.

README 文档

README

Latest Version on Packagist Total Downloads

This package contains a Flysystem adapter for Firebase Storage.

Installation

You can install the package via composer:

composer require galihlprakoso/flysystem-firebase-storage

Usage

PHP Usage

use galihlprakoso\Adapters\FirebaseStorageAdapter;
use Kreait\Firebase\Factory;

$factory = (new Factory())->withServiceAccount('<path to your service account json file>');
$storageClient = $factory->createStorage();

$adapter = new FirebaseStorageAdapter($storageClient, '<bucket name>');

Laravel Usage

Define the config in your filesystems.php file.

[
  'disks' => [
    //... another configuration    
    'firebase-storage' => [
        'driver' => 'firebase-storage',
        'service_account_json_name' => env('FIREBASE_STORAGE_SERVICE_ACCOUNT_JSON_NAME'),
        'bucket_name' => env('FIREBASE_STORAGE_BUCKET_NAME'),
    ],
  ]
]

Add this Storage extension in your Laravel's AppServiceProvider.php file, inside the boot() method:

Storage::extend('firebase-storage', function (Application $app, array $config) {
    $factory = (new Factory())->withServiceAccount(base_path('/' . $config['service_account_json_name']));
    $storageClient = $factory->createStorage();

    $adapter = new FirebaseStorageAdapter($storageClient, $config['bucket_name']);

    return new FilesystemAdapter(
        new Filesystem($adapter, $config),
        $adapter,
        $config
    );
});

Support My Work

统计信息

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

GitHub 信息

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

其他信息

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