simkeu / simkeu-gcp-repository
Sim Keuangan 将 Blob 上传到 Google Cloud Storage。
v1.0.0
2024-09-10 07:04 UTC
Requires
- php: ^5.6
- google/cloud-storage: ^1.30
- ramsey/uuid: ^3.7
README
连接到 blob 仓库的库
要求
- PHP 5.4 ++
- 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()