kapersoft / sharefile-api
ShareFile Api 的最小实现
1.1.0
2017-09-14 20:44 UTC
Requires
- php: ^7.0
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- larapack/dd: 1.*
- mikey179/vfsstream: ^1.6
- phpunit/phpunit: 6.4.x-dev
This package is not auto-updated.
Last update: 2024-09-15 04:31:22 UTC
README
ShareFile Api 的最小实现
这是一个 ShareFile Api 的最小 PHP 实现。它仅包含用于我的 flysystem-sharefile 适配器所需的方法。我欢迎 PR 添加客户端的额外方法。
以下是一些使用此包的示例
// Connect to ShareFile $client = new Client('hostname', 'client_id', 'secret', 'username', 'password'); // Create a folder $newFolder = $client->createFolder($parentId, $name, $description); // Upload a file in that folder $client->uploadFileStandard($filename, $newFolder['Id']); // Get details for a file using filepath $picture = $client->getItemByPath('/Personal Folders/Pictures/Picture.jpg'); // Using file details we can ask for the thumbnail url $client->getThumbnailUrl($picture['Id']); // Or the direct download link $client->getItemDownloadUrl($picture['Id']); // Or the contents of the file $client->getItemContents($picture['Id']);
安装
您可以通过 composer 安装此包
composer require kapersoft/sharefile-api
使用方法
您首先需要获取一个 OAuth2 密钥。访问 获取 API 密钥 部分,在 ShareFile API 网站 上获取此密钥。
有了 OAuth2 密钥,您就可以实例化一个 Kapersoft\Sharefile\Client
$client = new Client('hostname', 'client_id', 'secret', 'username', 'password');
查看 Kapersoft\ShareFile\Client
的源代码 以发现您可以使用的方法。更多示例可以在 Kapersoft\ShareFile\Test\TestShareFileApi
的源代码 中找到。
变更日志
请参阅 CHANGELOG 以获取有关最近更改的更多信息。
测试
在 /tests
文件夹中定义了两个测试
TestClient.php
使用模拟 Guzzle 对象测试Kapersoft\Sharefile\Client
类;TestShareFileApi.php
使用实时 ShareFile API 测试Kapersoft\Sharefile\Client
类。要使用此测试,请在项目根目录下的phpunit.xml.dist
文件的<PHP>
部分填写您的 ShareFile 凭据。某些测试需要额外的参数才能运行。这些参数可以在测试的第一行中找到。
安全性
如果您发现任何与安全性相关的问题,请通过电子邮件 kapersoft@gmail.com 联系,而不是使用问题跟踪器。
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 以获取更多信息。