PHP code example of justus / flysystem-onedrive

1. Go to this page and download the library: Download justus/flysystem-onedrive library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

justus / flysystem-onedrive example snippets


'onedrive' => [
    'driver' => 'onedrive',
    'root' => env('ONEDRIVE_ROOT'),
    'access_token' => env('ONEDRIVE_ACCESS_TOKEN'), //optional if demanded
    'directory_type' => env('ONEDRIVE_DIR_TYPE')
],

'providers' => [
    // ...
    Justus\FlysystemOneDrive\Providers\OneDriveAdapterServiceProvider::class,
    // ...
],

$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');

$options = [

];

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

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

$filesystem = new Filesystem($adapter);

$filesystem->createDirectory('test');