定制 justus/flysystem-onedrive 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

justus/flysystem-onedrive

最新稳定版本:v2.0.7

Composer 安装命令:

composer require justus/flysystem-onedrive

包简介

A flysystem driver for OneDrive that uses the Microsoft Graph API

README 文档

README

![Banner]

Flysystem adapter for Microsoft OneDrive

This package contains a Flysystem OneDrive adapter, which makes use of the Microsoft Graph API. The adapter is ready for the latest Laravel 12.x version.

You can use this package to access files stored in onedrive or sharepoint folders from your PHP or Laravel web applications.

CI Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

1. Installation

Simply install the package using composer:

composer require justus/flysystem-onedrive

2. Usage

Laravel Usage

  1. Add the following variables to your .env file

example for 'personal' OneDrive

ONEDRIVE_ROOT=me
ONEDRIVE_ACCESS_TOKEN=fd6s7a98...
ONEDRIVE_DIR_TYPE=drives

example for 'group shared' OneDrive

ONEDRIVE_ROOT="{group_id}/drive"
ONEDRIVE_ACCESS_TOKEN=fd6s7a98...
ONEDRIVE_DIR_TYPE=groups
  1. In the file config/filesystems.php, please add the following code snippet to the disks section
'onedrive' => [
    'driver' => 'onedrive',
    'root' => env('ONEDRIVE_ROOT'),
    'access_token' => env('ONEDRIVE_ACCESS_TOKEN'), //optional if demanded
    'directory_type' => env('ONEDRIVE_DIR_TYPE')
],
  1. Add the OneDriveAdapterServiceProvider in config/app.php
'providers' => [
    // ...
    Justus\FlysystemOneDrive\Providers\OneDriveAdapterServiceProvider::class,
    // ...
],

There are two established approaches of using the package

  • On demand: Recommended if you use a dynamic graph access token. (usage e. g. session('graph_access_token'))
$disk = Storage::build([
    'driver' => config('filesystems.disks.onedrive.driver'),
    'root' => config('filesystems.disks.onedrive.root'),
    'directory_type' => config('filesystems.disks.onedrive.directory_type'),
    'access_token' => session('graph_access_token')
]);

$disk->makeDirectory('test');
  • Default with Storage Facade: Recommended if you use a static graph access token.
Storage::disk('onedrive')->makeDirectory('test');

PHP Usage

Usage in php without Laravel framework

$options = [

];

$graph = new Graph();
$graph->setAccessToken('fd6s7a98...');

$adapter = new OneDriveAdapter($graph, 'root/path', $options);

$filesystem = new Filesystem($adapter);

$filesystem->createDirectory('test');

3. Changelog

Please see CHANGELOG for more information on recent changes.

4. Testing

composer test

5. Security

If you discover any security related issues, please write an email to jdonner@doerffler.com instead of using the issue tracker.

6. License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 85.81k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 47
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 47
  • Watchers: 3
  • Forks: 22
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固