1. Go to this page and download the library: Download vatri/google-drive-bundle 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/ */
use Vatri\GoogleDriveBundle\Service\DriveApiService;
...
public function test(DriveApiService $driveApiService): Response
{
if($driveApiService->isTokenExpired()){
return $this->redirectToRoute( $driveApiService->getAuthRouteName() );
}
$folderId = '[YOUR ID]';
$res = $driveApiService->listFiles($folderId, false, true );
dd($res);
}
if($driveApiService->isTokenExpired()){
// When auth is finished, redirect back to this URL:
$driveApiService->setRedirectPathAfterAuth(
$this->get('request_stack')->getCurrentRequest()->getRequestUri()
);
// Redirect
return $this->redirectToRoute( $driveApiService->getAuthRouteName() );
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.