PHP code example of patriceckhart / google-drive-api

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

    

patriceckhart / google-drive-api example snippets




use PatricEckhart\GoogleDriveClient;

class GoogleDrive
{

    /**
     * List files
     *
     * @return array
     */
    public function listFiles():array
    {
        $client = new GoogleDriveClient(
            '/data/neos/Data/Security/google/client_secret_768913446618-aax0u2k92nh350lij57ts58a0igm1a82.apps.googleusercontent.com.json', // clientIdPathAndFileName
            'https://redirecturi.com', // redirectUri
            '2//13pMQO5SH5KXaCgYIARAAAERSNwF-L9IrXHD7F1SLRD0r2xJ8PicU!2dCtoZxmdb6dGCzl5UQVCFArqstTaIoUuTW7MjnEAzyPIg', // refreshToken
            'https://www.googleapis.com/auth/drive', // scope
            '1K__pKH52TK3ZxeWSR8O-XOgYad31_xtt', // startingPoint (Folder ID)
            20 // pageSize
        );
        return $client->list();
    }

}