Download the PHP package brickservers/gsuite without Composer

On this page you can find all versions of the php package brickservers/gsuite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package gsuite

Google Workspace SDK for Laravel

Latest Version Total Downloads Tests

A Laravel package for managing Google Workspace (formerly G Suite). Friendly repositories for users and groups, plus every method of the Admin SDK Directory, Classroom, Calendar, Gmail and Drive APIs, with error handling, audit logging and safety rails built in.

Sponsor

Support the development of this package: Sponsor

Sponsor with Paystack

Features

Requirements

Installation

Publish Configuration

This will publish the configuration file to config/google-workspace.php.

Configuration

1. Set Up Google Cloud Project

  1. Go to Google Cloud Console
  2. Create a new project
  3. Enable the Admin SDK API, plus the Classroom, Calendar, Gmail or Drive APIs if you use them
  4. Create a service account and download its JSON key
  5. Move the key to storage/credentials.json (or set GOOGLE_WORKSPACE_CREDENTIALS_PATH)
  6. In the Google Admin console, go to Security → Access and data control → API controls → Domain-wide delegation, add the service account's client ID, and authorize the scopes from your config (and any you pass to asUser())

2. Configure Environment Variables

Add these to your .env file:

GOOGLE_WORKSPACE_SUBJECT is required: it is the admin account the service account impersonates through domain-wide delegation.

3. Update Configuration

Edit config/google-workspace.php to customize settings:

The default scopes cover the users and groups repositories. If you use other parts of the API through directory(), classroom(), calendar(), gmail() or drive(), add the scopes they need and authorize them for the service account in the Google Admin console. Google's service classes define a constant for every scope, e.g. Google\Service\Directory::ADMIN_DIRECTORY_ORGUNIT or Google\Service\Calendar::CALENDAR.

Usage

Basic Setup

User Management

Create a User

givenName and familyName are required when creating. New users must change their password at next login unless you pass changePasswordAtNextLogin: false.

Get a User

List Users

Update a User

Only the fields you set are sent; everything else is left unchanged.

Setting email to a different address renames the user. Protected users cannot be renamed.

Delete a User

Users in the undeletable list cannot be deleted, renamed or suspended, whether you refer to them by email (any case), alias or user ID.

Suspend/Unsuspend a User

Make a User a Super Admin

Disabled by default because it grants full control of the domain. Enable it with GOOGLE_WORKSPACE_ALLOW_ADMIN_PROMOTION=true; otherwise an access denied exception (code 403) is thrown.

Manage User Aliases

Group Management

Create a Group

Get a Group

List Groups

Update a Group

Delete a Group

Manage Group Members

Full API Access

Every resource and method of the Directory, Classroom, Calendar, Gmail and Drive APIs is available through directory(), classroom(), calendar(), gmail() and drive(). Resource and method names match Google's PHP client (and its API reference), and arguments and return values are Google's own model classes:

Every call:

For anything else, ->google() returns the underlying Google\Service\* object.

Acting as a User

Gmail, Calendar and Drive mostly work on a particular user's data. asUser() impersonates that user through domain-wide delegation:

The impersonated account needs the right scopes. By default asUser() uses the configured scopes; pass others as the second argument. Every scope must be authorized for the service account under Security → API controls → Domain-wide delegation in the Google Admin console. Google's service classes define constants for each scope:

users(), groups() and batch() always act as the configured admin, even after asUser().

Paginating Any List

Pass the list method's name followed by its normal arguments.

Batch Operations

Bulk user creation and group membership changes are sent as Google batch requests (up to 1000 calls per HTTP request). Each item succeeds or fails on its own:

Error Handling

The package throws GoogleWorkspaceException for all API errors:

Exception Codes

Code Meaning
1 Invalid configuration (e.g. missing subject, or an API method missing from an outdated google/apiclient-services)
2 Credentials file not found
3 Other API error
4 Validation error
5 Resource not found (Google returned 404)
6 Protected resource (cannot delete, rename or suspend)
7 Connection error
8 Invalid argument (e.g. an update with no fields)
403 Access denied (Google returned 401/403, or admin promotion disabled)
429 Rate limit or quota exceeded

Transient failures (5xx, rate limits, network errors) are retried automatically according to the retry settings before an exception is thrown.

Data Transfer Objects (DTOs)

UserDTO

null means "not set": the field is left out of API requests. An empty email is also left out.

GroupDTO

Enums

UserProjection

UserViewType

ApiScope

Common OAuth scopes:

For the complete list, use the constants on Google's service classes (e.g. Google\Service\Gmail::GMAIL_SETTINGS_SHARING).

Migration from Old Package

See MIGRATION.md for full upgrade guides, including the breaking changes in 3.0. If you're upgrading from wyattcast44/gsuite:

Changes Summary

  1. Namespace Changed: Wyattcast44\GSuite → BrickServers\GoogleWorkspace
  2. New DTOs: Use UserDTO and GroupDTO instead of raw arrays
  3. Type-Safe: All methods now have proper type hints
  4. Better Errors: Custom exception types for better error handling
  5. Modern PHP: Uses PHP 8.2+ features (enums, readonly types, named arguments)

Migration Steps

Before (Old Package)

After (New Package)

Testing

Run with coverage:

Logging

Every change made through the package is logged: repository actions (creates, updates, deletes, suspensions, aliases, membership changes, admin promotions) and every non-read call through the API wrappers, recorded as Google Workspace API change with the method (e.g. gmail.usersSettings.updateVacation), its ID arguments and, after asUser(), the impersonated account. Request bodies are not logged.

Logs go to your application's default channel. Send them elsewhere with GOOGLE_WORKSPACE_LOG_CHANNEL, or turn logging off with GOOGLE_WORKSPACE_LOGGING=false.

Supported APIs

Every method of these Google APIs is available, with Google's own documentation on each method:

API Accessor Resources Methods
Admin SDK Directory directory() 28 128
Classroom classroom() 24 104
Calendar calendar() 8 38
Gmail gmail() 15 79
Drive drive() 14 64

Users and groups also have the friendlier repositories documented above.

Security Best Practices

  1. Never commit credentials.json - Add to .gitignore
  2. Use environment variables - Store sensitive data in .env
  3. Limit API scopes - Only request and authorize the scopes your app needs; domain-wide delegation lets the service account act as any user for those scopes
  4. Keep audit logging on - Every change is logged by default
  5. Use protected resources - Add critical accounts/groups to the undeletable list (emails, aliases or IDs)
  6. Leave admin promotion off - Only enable allow_admin_promotion if your app really needs it
  7. Authorize your own users - The package acts with full admin rights, and asUser() can reach any user's mail, calendar and files; check in your app who may trigger each action

Performance Tips

  1. Iterate with all() / paginate() - Pages are fetched lazily instead of loading everything at once
  2. Cache results - Store frequently accessed data
  3. Use batch() - Bulk creates and membership changes need far fewer HTTP requests
  4. Tune retries - Raise retry.max_attempts for large jobs that hit rate limits

Contributing

The API wrappers in src/Api/{Directory,Classroom,Calendar,Gmail,Drive} are generated. Don't edit them by hand: run composer generate-api after updating google/apiclient-services to pick up new Google endpoints.

Contributions are welcome! Please include tests, and run composer test, composer lint and composer analyze before opening a pull request (CI runs all three).

Changelog

See CHANGELOG.md for version history and breaking changes.

License

The MIT License (MIT). Please see License File for more information.

Support

For issues, questions, or suggestions, please open an issue on GitHub.

Credits


All versions of gsuite with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
google/apiclient Version ^2.19
google/apiclient-services Version ~0.461
illuminate/contracts Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
psr/log Version ^1.1|^2.0|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package brickservers/gsuite contains the following files

Loading the files please wait ...