require_once 'vendor/autoload.php'; $client = new Google_Client(); $client->setApplicationName('My App'); $client->setAuthConfig('client_secret.json'); $service = new Google_Service_Drive($client);
require_once 'vendor/autoload.php'; $client = new Google_Client(); $client->setApplicationName('My App'); $client->setAuthConfig('client_secret.json'); $service = new Google_Service_Sheets($client);In this example, we create a new client object and set its application name and authentication configuration. Then, we use the addService method to add the Google Sheets API service to the client object. Package library: Google API PHP client library.