megasent1 / flysystem-onedrive
OneDrive API 的 Flysystem 适配器
v2.0.0
2022-04-19 11:15 UTC
Requires
- php: ^8.0
- league/flysystem: ^3.0
- microsoft/microsoft-graph: ^1.0
Requires (Dev)
- phpunit/phpunit: ^9.5.10
README
Microsoft OneDrive API 的 Flysystem 适配器
此包包含一个 Flysystem 适配器用于 OneDrive。底层使用了 Microsoft Graph SDK。
安装
您可以通过 composer 安装此包
composer require megasent1/flysystem-onedrive
或在 composer.json 中直接添加此仓库
"repositories": [ { "url": "https://github.com/megasent1/flysystem-onedrive.git", "type": "git" } ],
用法
首先,您需要为 Microsoft Graph API 获取一个授权令牌。为此,您需要在 Microsoft Azure Portal 上创建一个应用。
use Microsoft\Graph\Graph; use League\Flysystem\Filesystem; use MarioPerrotta\FlysystemOneDrive\OneDriveAdapter; $graph = new Graph(); $graph->setAccessToken('EwBIA8l6BAAU7p9QDpi...'); $adapter = new OneDriveAdapter($graph, 'root'); $filesystem = new Filesystem($adapter); // Or to use the approot endpoint: $adapter = new OneDriveAdapter($graph, 'special/approot');
变更日志
请参阅 CHANGELOG 了解最近的变化。
测试
$ composer test
贡献
请参阅 CONTRIBUTING 了解详情。
安全性
如果您发现任何与安全性相关的问题,请通过电子邮件 nicolasbeauvais1@gmail.com 联系,而不是使用问题跟踪器。
致谢
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。