kamilz / b2backblaze
PHP5 库,提供 B2 云存储的 API
v0.1.3
2017-06-17 12:46 UTC
Requires
- php: >=5.3.2
- kriswallsmith/buzz: >= 0.15
Suggests
- ext-curl: *
- kamilz/b2backblaze-bundle: to use with Symfony2
This package is not auto-updated.
Last update: 2024-09-14 19:03:52 UTC
README
B2Backblaze 是一个 PHP5 库,提供 B2 API 客户端。
B2 云存储?
B2 云存储 是一种云存储服务,可以将文件存储在云端。文件可以通过 API 或浏览器兼容的 URL 在任何时间下载。
使用 B2 云存储 API,您可以
-
管理账户配置
-
创建和管理包含文件的存储桶
-
上传、下载和删除文件
安装
php composer.phar require kamilZ/b2backblaze:0.1.*
试试看!
如果只需要 API 集成,可以使用 B2API.php 类。否则使用 B2Service.php。B2Service 是一个自定义集成,面向文件名,这是我们通常在数据库中保存的信息。
<?php use B2Backblaze\B2Service; $client = new B2Service($account_id, $application_key); //Authenticate with server. Anyway, all methods will ensure the authorization. $client->authorize() // Returns true if bucket exists $client->isBucketExist($bucketId) //Returns the bucket information array. $client->getBucketById($bucketId) //Returns the file content and file metadata. Set $metadataOnly to true if you only need metadata information. $client->get($bucketName, $fileName, $private = false, $metadataOnly = false) //Return ziped foled of list files by name. $client->getAllZip($bucketName, array $filesName, $zipFileName, $private = false) //Inserts file and returns array of file metadata. $client->insert($bucketId, $file, $fileName) //Insert large file $client->insertLarge($bucketId, $filePath, $fileName) //Delete last file version $client->delete($bucketName, $fileName, $private = false) //Rename file in bucket $client->rename($bucketName, null, $fileName, $targetBucketId, $newFileName, $private = false) //Returns the list of files in bucket. $client->all($bucketId) //Check if the file exists (Internally: We are making a HEAD request, not downloading the file only the response headers, so is less expensive than the query with "existInList". Transactions Class B) $client->exists($bucketName, $fileName) //Check if the file exists in a bucket (Internally: Transactions Class C) $client->existsInList($bucketId, $fileName)
集成!
与 symfony2 一起使用的捆绑包: https://github.com/kamilZ/B2BackblazeBundle
Gaufrette 文件系统抽象库分支: https://github.com/kamilZ/Gaufrette
为您的 Symfony 项目提供 Gaufrette 集成: https://github.com/kamilZ/KnpGaufretteBundle