Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

francoisp-houzz/g-suite-php-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

g-suite-php-sdk

Google Workspace PHP SDK

Description

This is Vendasta's official PHP SDK for API integration of Google Workspace.

Requirements

Installation

Install the requirements from above, then:

composer require vendasta/gsuite

Authentication

To authenticate your SDK calls, you must provision a service account from within the Vendasta platform.

You must put this file on your server, and set an environment variable to its path:

export VENDASTA_APPLICATION_CREDENTIALS=<path to credentials.json>

Client Initialization

It is highly recommended that you use a singleton client instance. Each client initialization will open its own connection, therefore using a singleton results in reusing a connection, saving time and resources.

Set an environment variable:

export ENVIRONMENT=<DEMO or PROD> 

To instantiate the client:

$environment = getenv("ENVIRONMENT");
if ($environment == null) {
    $environment = "DEMO";
}

$client = new Vendasta\GSuite\V1\PartnerClient($environment);

Notice that the environment will be set to DEMO if it is not specified.

Getting domain information

$req = new GSuite\V1\GetDomainInformationRequest();
$req->setDomain("<domain>");
$resp = $client->GetDomainInformation($req);

Reducing seats

If needed, a list of subscriptions and their SKU IDs can be found here.

$req = new ListSubscriptionsRequest();
$req->setDomain("<domain>");

$resp = $client->ListSubscriptions($req);

$subscriptions = $resp->getSubscriptions();
$subscriptionID = $subscriptions[0]->getSubscriptionId();

$req = new ChangeSeatsRequest();
$req->setCustomerId("<domain>");
$req->setSubscriptionId($subscriptionID);
$req->setSeats(1);

$resp = $client->ChangeSeats($req);

Disabling SSO

$req = new UpdateSSORequest();
$req->setDomain("<domain>");
// disable SSO
$req->setEnableSso(false);

$resp = $client->UpdateSSO($req);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%