PHPackages                             thotam/flysystem-onedrive - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. thotam/flysystem-onedrive

ActiveLibrary[File &amp; Storage](/categories/file-storage)

thotam/flysystem-onedrive
=========================

A flysystem driver for OneDrive that uses the Microsoft Graph API

01PHP

Since Jul 3Pushed 2y agoCompare

[ Source](https://github.com/thotam/flysystem-onedrive)[ Packagist](https://packagist.org/packages/thotam/flysystem-onedrive)[ RSS](/packages/thotam-flysystem-onedrive/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![![Banner]](https://camo.githubusercontent.com/5541d462f49f1f5bea4f093746b196e8274f561953a8e8bb79161004b1ad7853/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f466c7973797374656d2532304f6e6544726976652e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6a7573747573253246666c7973797374656d2d6f6e656472697665267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d412b666c7973797374656d2b6472697665722b666f722b4f6e6544726976652b746861742b757365732b7468652b4d6963726f736f66742b47726170682b415049266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d636c6f7564)](https://camo.githubusercontent.com/5541d462f49f1f5bea4f093746b196e8274f561953a8e8bb79161004b1ad7853/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f466c7973797374656d2532304f6e6544726976652e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6a7573747573253246666c7973797374656d2d6f6e656472697665267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d412b666c7973797374656d2b6472697665722b666f722b4f6e6544726976652b746861742b757365732b7468652b4d6963726f736f66742b47726170682b415049266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d636c6f7564)

Flysystem adapter for Microsoft OneDrive
========================================

[](#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 9.x version.

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

[![Latest Stable Version](https://camo.githubusercontent.com/28549e65862a9fb2d5d9366227df461993729d2e87c3880e7d6a3bf63c7fea9e/687474703a2f2f706f7365722e707567782e6f72672f6a75737475732f666c7973797374656d2d6f6e6564726976652f76)](https://packagist.org/packages/justus/flysystem-onedrive) [![Total Downloads](https://camo.githubusercontent.com/48caffea7cb5d66c135b0d5d18543e4faa3fa38a399150cf4a012011a3f03d90/687474703a2f2f706f7365722e707567782e6f72672f6a75737475732f666c7973797374656d2d6f6e6564726976652f646f776e6c6f616473)](https://packagist.org/packages/justus/flysystem-onedrive) [![Latest Unstable Version](https://camo.githubusercontent.com/c8b89e3ae5d2526aaefae8c3fae6612fbbc29bf5146219aa200a9839b08cb312/687474703a2f2f706f7365722e707567782e6f72672f6a75737475732f666c7973797374656d2d6f6e6564726976652f762f756e737461626c65)](https://packagist.org/packages/justus/flysystem-onedrive) [![License](https://camo.githubusercontent.com/86548bc211a3582688dbd646a0de569decc29c5b127da41c4baa744f6d71f97f/687474703a2f2f706f7365722e707567782e6f72672f6a75737475732f666c7973797374656d2d6f6e6564726976652f6c6963656e7365)](https://packagist.org/packages/justus/flysystem-onedrive) [![PHP Version Require](https://camo.githubusercontent.com/0a9b6cb5c58506d05dbe89b54d0d33ced8a1b6de8d8e9dcc06908445c257e79b/687474703a2f2f706f7365722e707567782e6f72672f6a75737475732f666c7973797374656d2d6f6e6564726976652f726571756972652f706870)](https://packagist.org/packages/justus/flysystem-onedrive)

1. Installation
---------------

[](#1-installation)

Simply install the package using composer:

`composer require justus/flysystem-onedrive`

2. Usage
--------

[](#2-usage)

### Laravel 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
```

2. 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')
],
```

3. 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

[](#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
------------

[](#3-changelog)

Please see CHANGELOG for more information on recent changes.

4. Testing
----------

[](#4-testing)

`$ composer test`

5. Security
-----------

[](#5-security)

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

6. License
----------

[](#6-license)

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

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f582d4e5281117fa1d2e794c51134b94fca5f722e82ddc885da5ee1d7c7a0af5?d=identicon)[thotam](/maintainers/thotam)

---

Top Contributors

[![Jusdon](https://avatars.githubusercontent.com/u/34418811?v=4)](https://github.com/Jusdon "Jusdon (28 commits)")[![timo2o1o](https://avatars.githubusercontent.com/u/8312711?v=4)](https://github.com/timo2o1o "timo2o1o (3 commits)")[![kfriars](https://avatars.githubusercontent.com/u/3378675?v=4)](https://github.com/kfriars "kfriars (2 commits)")[![thotam](https://avatars.githubusercontent.com/u/78630736?v=4)](https://github.com/thotam "thotam (2 commits)")

### Embed Badge

![Health badge](/badges/thotam-flysystem-onedrive/health.svg)

```
[![Health](https://phpackages.com/badges/thotam-flysystem-onedrive/health.svg)](https://phpackages.com/packages/thotam-flysystem-onedrive)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
