PHPackages                             vendasta/g-suite - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. vendasta/g-suite

ActiveLibrary[API Development](/categories/api)

vendasta/g-suite
================

PHP library for Vendasta's GSuite service

1.1.0(1y ago)0881[1 issues](https://github.com/vendasta/g-suite-php-sdk/issues)PHP

Since Jul 22Pushed 1y ago27 watchersCompare

[ Source](https://github.com/vendasta/g-suite-php-sdk)[ Packagist](https://packagist.org/packages/vendasta/g-suite)[ RSS](/packages/vendasta-g-suite/feed)WikiDiscussions master Synced yesterday

READMEChangelog (8)Dependencies (6)Versions (11)Used By (0)

Vendasta Google Workspace PHP SDK
=================================

[](#vendasta-google-workspace-php-sdk)

Description
-----------

[](#description)

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

Requirements
------------

[](#requirements)

- PHP 5.5 and above or PHP 7.0 and above
- [PECL](https://pecl.php.net/) (may be used to install the required PHP extensions)
- [Composer](https://getcomposer.org/)
- [PHP gmp extension](http://php.net/manual/en/book.gmp.php)
- OPTIONAL (but recommended): [PHP grpc extension](https://cloud.google.com/php/grpc)

Installation
------------

[](#installation)

Install the requirements from above, then:

```
composer require vendasta/gsuite
```

Authentication
--------------

[](#authentication)

To authenticate your SDK calls, you must provision a service account from within the Vendasta platform. Refer to the [service account guide](https://developers.vendasta.com/guides/service-accounts) in order to setup authentication.

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

```
export VENDASTA_APPLICATION_CREDENTIALS=
```

Client Initialization
---------------------

[](#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=
```

To instantiate the client:

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

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

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

Provisioning a Google Workspace account
---------------------------------------

[](#provisioning-a-google-workspace-account)

Provisioning a new Google Workspace account can be done using the [Account Group SDK](https://packagist.org/packages/vendasta/accountgroup) and [Sales Orders SDK](https://packagist.org/packages/vendasta/sales-orders). The Account Group SDK is used to create business accounts in Partner Center. Follow the readme for installation and setup. Create is synchronous. It immediately creates the account and returns the account group ID for the business you made (used as the business ID in the other SDKs). After a business is created you can use the Sales Orders SDK to purchase products on that business using the business ID from the Account Group SDK. CreateAndActivateOrder is an asynchronous process which can result in approval or rejection from the vendor. The status of the order can be polled using the GetSalesOrder endpoint given the order ID from CreateAndActivateOrder.

### Production App and Add-on IDs

[](#production-app-and-add-on-ids)

- Google Workspace Business Starter - MP-XBHPSLDBHZ8Q8F57P43DPKL6SPHKHHMS
    - Google Workspace Seat - A-PSZPWNCFWM
- Google Workspace Business Standard - MP-BJ37LGNT37SDN6LR7D46MPP7CBG82MN6
    - Google Workspace Seat - A-DH5P2QL4MG
- Google Workspace Business Plus - MP-S2RJ778BSJR7KXFSS775BHCX383CJVSV
    - Google Workspace Seat - A-3MC43W3SXM
- Google Workspace Enterprise - MP-FCZGBZM4ZNSGV26CCKVB6GM4F8T5Q6HG
    - Google Workspace Seat - A-QH5H53VTKQ
- Google Workspace Transfer - MP-LMVNT4HKZCXTVDFMVT62Q6VB3ZJGNQC6

### Demo environment App and Add-on IDs

[](#demo-environment-app-and-add-on-ids)

- Google Workspace Business Starter - MP-6XDHVMQ84K4THNNP2Z7W2GC28VLHRC4Q
    - Google Workspace Seat - A-JMJX3KJPT5
- Google Workspace Business Standard - MP-GNWSMJS4BJB4Z8RZWZ8SXW6J4HP32KJ3
    - Google Workspace Seat - A-JZTKNPKBDL
- Google Workspace Business Plus - MP-8PS55DCP5DKMDPDHHPWSFPD8XCM44324
    - Google Workspace Seat - A-XMF5CQJPJQ
- Google Workspace Enterprise - MP-VDNQPHCTCMHVMSNW87R8N3NRTS4HC6LV
    - Google Workspace Seat - A-T5LTKP7ZTV
- Google Workspace Transfer - MP-7TMH5K8N7KNNRZ5NC4RNNS2JFK64HMNC

```
// Choose environment and partnerId
$env = "DEMO";
$pid = "";

// Instantiate clients
$accountGroupClient = new AccountGroupServiceClient($env);
$gSuiteClient = new GSuitePartnerClient($env);
$salesOrdersClient = new SalesOrdersClient($env);

// Build request to create a business
$createReq = new CreateAccountGroupRequest();
$location = new AccountGroupLocation();
$location->setCompanyName("Test Company");
$location->setAddress("123 Street Name");
$location->setCity("Chicago");
$location->setState("IL");
$location->setCountry("US");
$location->setZip("88888");
$workNumber = array("(999) 999-9999");
$location->setWorkNumber($workNumber);
$createReq->setAccountGroupNap($location);
$createReq->setPartnerId($pid);

// Make call and store returned accountGroupId
$resp = $accountGroupClient->Create($createReq);
$accountGroupId = $resp->getAccountGroupId();

// Build sales order request & activate the products
// Create the request
$req = new CreateAndActivateOrderRequest();

// Create the line items
$gSuite = SalesOrdersUtils::buildLineItem('MP-6XDHVMQ84K4THNNP2Z7W2GC28VLHRC4Q');
$lineItems = array($gSuite);

// Create the custom field
$gSuiteCustomField = SalesOrdersUtils::buildGSuiteCustomField("MP-6XDHVMQ84K4THNNP2Z7W2GC28VLHRC4Q", 'testdomain123.com', 'adminusername', 'First', 'Last', 'example@email.com');
$customFields = array($gSuiteCustomField);

// Create the order
$order = SalesOrdersUtils::buildOrder($pid, $accountGroupId, $lineItems, $customFields);
$req->setOrder($order);

// Call CreateAndActivateOrder
$resp = $salesOrdersClient->CreateAndActivateOrder($req);

// Poll the pending activation process using GetSalesOrder

// Build request to get Google Workspace domain information
$req = new GetDomainInformationRequest();
$req->setDomain("");

// Make request and store the DNS TXT record
$resp = $gSuiteClient->GetDomainInformation($req);
$txtRecord=  $resp->getDomainInformation()->getDnsTxtRecord();
```

Deprovision an account
----------------------

[](#deprovision-an-account)

```
// Choose environment and partnerId
$env = "DEMO";
$pid = "";

// Select the app ID and business ID to deactivate
$businessId = "";
$appId = "";

// The activation ID will be populated after we list all the products on the business
$activationId = "";

$client = new AccountsServiceClient($env);

// First list all of the current products activated for that business and find the one matching the appID
$listReq = new ListRequest();
$listReq->setPartnerId($pid);
$listReq->setBusinessId($businessId);
$resp = $client->List($listReq);
foreach($resp->getAccounts() as $account) {
    if ($account->getAppId() == $appId) {
        // The activation ID is necessary for deactivating an app
        $activationId = $account->getActivationId();
    }
}

// Build the deactivation request with the activation ID
$deactivationReq = new DeactivateAppRequest();
$deactivationReq->setBusinessId($businessId);
$deactivationReq->setAppId($appId);
$deactivationReq->setActivationId($activationId);
$deactivationReq->setDeactivationType(DeactivationType::DEACTIVATION_TYPE_CANCEL);
```

How to use this SDK
-------------------

[](#how-to-use-this-sdk)

### Getting domain information

[](#getting-domain-information)

To get the information for a domain including the TXT record and status:

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

### Reducing seats

[](#reducing-seats)

To reduce seats on a subscription list subscriptions on a domain and then calling the ChangeSeats endpoint with a subscription ID. This [page](https://developers.google.com/admin-sdk/licensing/v1/how-tos/products) can be referenced to determine which SKU ID you would like to change seats for if there is more than one subscription on the domain.

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

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

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

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

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

### Disabling SSO

[](#disabling-sso)

SSO is turned on by default. To toggle it off:

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

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

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance47

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 57.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~215 days

Recently: every ~407 days

Total

9

Last Release

395d ago

Major Versions

0.2.3 → 1.0.02021-02-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/1498d6f30e570d34309cfb7c848cb3b80d0eca6bd8e28af9d5db3f4196b300bb?d=identicon)[vendasta](/maintainers/vendasta)

---

Top Contributors

[![kamundson-va](https://avatars.githubusercontent.com/u/15634999?v=4)](https://github.com/kamundson-va "kamundson-va (11 commits)")[![bbudz-va](https://avatars.githubusercontent.com/u/19170994?v=4)](https://github.com/bbudz-va "bbudz-va (3 commits)")[![gabrielsond](https://avatars.githubusercontent.com/u/228783?v=4)](https://github.com/gabrielsond "gabrielsond (3 commits)")[![avadan1](https://avatars.githubusercontent.com/u/83599192?v=4)](https://github.com/avadan1 "avadan1 (1 commits)")[![francoisp-houzz](https://avatars.githubusercontent.com/u/44957708?v=4)](https://github.com/francoisp-houzz "francoisp-houzz (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vendasta-g-suite/health.svg)

```
[![Health](https://phpackages.com/badges/vendasta-g-suite/health.svg)](https://phpackages.com/packages/vendasta-g-suite)
```

###  Alternatives

[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)[google/grpc-gcp

gRPC GCP library for channel management

18497.8M3](/packages/google-grpc-gcp)[googleads/google-ads-php

Google Ads API client for PHP

3497.6M9](/packages/googleads-google-ads-php)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[agence104/livekit-server-sdk

Server-side SDK for LiveKit.

79189.9k1](/packages/agence104-livekit-server-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
