![![Banner]](https://banners.beyondco.de/Flysystem%20OneDrive.png?theme=light&packageManager=composer+require&packageName=justus%2Fflysystem-onedrive&pattern=architect&style=style_1&description=A+flysystem+driver+for+OneDrive+that+uses+the+Microsoft+Graph+API&md=1&showWatermark=0&fontSize=100px&images=cloud)
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.
Simply install the package using composer:
composer require justus/flysystem-onedrive
.env fileexample 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
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')
],
OneDriveAdapterServiceProvider in config/app.php'providers' => [
// ...
Justus\FlysystemOneDrive\Providers\OneDriveAdapterServiceProvider::class,
// ...
],
There are two established approaches of using the package
$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');
Storage::disk('onedrive')->makeDirectory('test');
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');
Please see CHANGELOG for more information on recent changes.
composer test
If you discover any security related issues, please write an email to jdonner@doerffler.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
PHP
100.0%
![![Banner]](https://banners.beyondco.de/Flysystem%20OneDrive.png?theme=light&packageManager=composer+require&packageName=justus%2Fflysystem-onedrive&pattern=architect&style=style_1&description=A+flysystem+driver+for+OneDrive+that+uses+the+Microsoft+Graph+API&md=1&showWatermark=0&fontSize=100px&images=cloud)
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.
Simply install the package using composer:
composer require justus/flysystem-onedrive
.env fileexample 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
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')
],
OneDriveAdapterServiceProvider in config/app.php'providers' => [
// ...
Justus\FlysystemOneDrive\Providers\OneDriveAdapterServiceProvider::class,
// ...
],
There are two established approaches of using the package
$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');
Storage::disk('onedrive')->makeDirectory('test');
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');
Please see CHANGELOG for more information on recent changes.
composer test
If you discover any security related issues, please write an email to jdonner@doerffler.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
PHP
100.0%