![]() $file = new \Google_Service_Drive_DriveFile() The service is created first by calling the getClient which returns an initialized \Google_Client object, which in turn gets the credentials.json path passed into it.įor example with a code like this: $driveService = $this->getGoogleDriveService( \Google_Service_Drive::DRIVE ) I call the getGoogleDriveService telling what scopes I want for the specific controller action, to create the Google Service. $projectDir = $this->get( 'kernel' )->getProjectDir() Private function getSecretPath() : string $client->setAuthConfig( $this->getSecretPath() ) ![]() $client->setApplicationName( 'My nice application name.' ) Private function getClient( string $scopes ) : \Google_Client ![]() $service = new \Google_Service_Drive( $client ) I have those private methods in my controller: private function getGoogleDriveService( string $scopes ) : \Google_Service_Drive I have required the google/apiclient PHP client library. I want my PHP web application to create spreadsheets in a specific google account (not arbitrary user's account, but a specific account of our company). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |