PHP code example of w3lifer / php-google-drive

1. Go to this page and download the library: Download w3lifer/php-google-drive 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/ */

    

w3lifer / php-google-drive example snippets

 sh
composer 
 php


// Google\Drive;

$googleDrive = new Drive([
    'pathToCredentials' => __DIR__ . '/credentials.json', // Required
    'pathToToken' => __DIR__ . '/token.json', // Required
]);

$fileId = $googleDrive->upload(
    __DIR__ . '/hello.txt',  // Required
    [ // Optional
        '<folder id>',
        '<folder id>',
    ]
);
 php
$googleDrive = new Drive([
    'pathToCredentials' => __DIR__ . '/credentials.json', // Required
    'pathToToken' => __DIR__ . '/token.json', // Required
]);