simkeu/simkeu-gcp-repository

Sim Keuangan 将 Blob 上传到 Google Cloud Storage。

v1.0.0 2024-09-10 07:04 UTC

This package is auto-updated.

Last update: 2024-09-12 07:20:41 UTC


README

连接到 blob 仓库的库

要求

  1. PHP 5.4 ++
  2. guzzle

示例在 test-upload.php 中

安装

run composer require simkeu/simkeu-gcp-repository

使用方法

Instalation
<?php

require_once 'vendor/autoload.php';
use Simkeu\GoogleCloudStorageRepository\GoogleCloudStorageRepository;

// Create a new StorageClient
$pathclientSecret = './myits-finance-690fb7a37295.json';
$storage = new GoogleCloudStorageRepository('simkeu', $pathclientSecret);

Store File 
$respon = $storage->uploadFile($_FILES['fileToUpload'], 'temp');

Update File 
$respon = $storage->updateFile($file_id, $_FILES['fileToUpload'], 'temp');

Delete File
$file = $storage->hapusFile($file_id);

Get File
$file  = $storage->getFile($file_id); //return base64 file
Methods

uploadFile()
updateFile()
hapusFile()
getFile()