PHP code example of joytekmotion / zoho-workdrive

1. Go to this page and download the library: Download joytekmotion/zoho-workdrive 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/ */

    

joytekmotion / zoho-workdrive example snippets


'workdrive' => [
    'driver' => 'workdrive',
    'client_id' => env('ZOHO_CLIENT_ID'),
    'client_secret' => env('ZOHO_CLIENT_SECRET'),
    'refresh_token' => env('ZOHO_REFRESH_TOKEN')
]

'providers' => [
    ...
    Joytekmotion\Zoho\Oauth\Providers\ZohoOauthServiceProvider::class,
    ...
]

namespace App\Providers;

use Illuminate\Support\Facades\Storage;
use Joytekmotion\Zoho\Workdrive\WorkdriveAdapter;
use Joytekmotion\Zoho\Oauth\SelfClient;
use Illuminate\Filesystem\FilesystemAdapter;
use League\Flysystem\Filesystem;

publc function boot()
{
    Storage::extend('workdrive', function ($app, $config) {
        $adapter =  new WorkDriveAdapter(
            new SelfClient(
                config('zoho.oauth_base_url'),
                $config['client_id'],
                $config['client_secret'],
                $config['refresh_token']
            )
        );
        return new FilesystemAdapter(
            new Filesystem($adapter, $config), $adapter, $config
        );
    });
}

use Illuminate\Support\Facades\Storage;

Storage::disk('workdrive')->put('virtual-folder-id/file.txt', 'contents');

use Illuminate\Support\Facades\Storage;

$contents = Storage::disk('workdrive')->get('virtual-folder-id/file.txt');

use Illuminate\Support\Facades\Storage;

$exists = Storage::disk('workdrive')->exists('virtual-folder-id/file.txt');
bash
php artisan zoho-oauth:refresh-token {code}
bash
php artisan vendor:publish --provider="Joytekmotion\Zoho\Oauth\Providers\ZohoOauthServiceProvider"