laravel-google-workspace maintained by koderia-creative-lab
Description
A modern Laravel wrapper around google/apiclient for Google Workspace Admin Directory, Classroom, Calendar/Meet, and Drive.
Author
Last update
2026/11/30 09:41
(dev-main)
License
Downloads
4
Tags
Laravel Google Workspace
A modern Laravel wrapper around google/apiclient for Admin Directory (users, passwords, groups, OUs, aliases), Google Classroom, Google Calendar / Meet, and Google Drive using Service Account Domain-Wide Delegation.
Installation
composer require koderia-creative-lab/laravel-google-workspace
Publish configuration:
php artisan vendor:publish --tag="google-workspace-config"
Configuration
Set the following environment variables in .env:
GOOGLE_SERVICE_ACCOUNT_JSON=/path/to/storage/app/google/service-account.json
GOOGLE_CLIENT_SUBJECT=admin@yourdomain.com
GOOGLE_WORKSPACE_TIMEZONE=Africa/Lagos
Usage
Admin Directory (Users, Passwords, Groups, OUs, Aliases)
use Koderia\GoogleWorkspace\Facades\GoogleWorkspace;
$directory = GoogleWorkspace::directory();
// Create a user
$directory->createUser('ada@domain.com', 'Ada', 'Lovelace', 'TempPass123!', '/Students', true, 'students@domain.com');
// Change password directly in Directory
$directory->changePassword('ada@domain.com', 'NewStrongPass456!', changePasswordAtNextLogin: false);
// Suspend / Unsuspend / Sign out active sessions
$directory->suspendUser('ada@domain.com');
$directory->unsuspendUser('ada@domain.com');
$directory->signOutUser('ada@domain.com');
// Aliases & Organizational Units
$directory->addAlias('ada@domain.com', 'ada.l@domain.com');
$directory->moveUserToOrgUnit('ada@domain.com', '/Alumni');
Google Classroom
$classroom = GoogleWorkspace::actingAs('lecturer@domain.com')->classroom();
$course = $classroom->createCourse('CSC 101', '2026/2027');
$classroom->addTeacher($course->getId(), 'lecturer@domain.com');
$classroom->addStudent($course->getId(), 'student@domain.com');
$classroom->createAssignment($course->getId(), 'Lab 1', 'Submit PDF report', '2026-12-15');
Google Calendar & Meet
$meetUrl = GoogleWorkspace::calendar()->createMeetEvent(
title: 'Departmental Board Meeting',
date: '2026-12-01',
time: '10:00',
durationMinutes: 60,
attendeeEmails: ['hod@domain.com', 'dean@domain.com']
);
Google Drive
$folder = GoogleWorkspace::drive()->createFolder('Student Transcripts');
GoogleWorkspace::drive()->shareFile($folder->getId(), 'registrar@domain.com', 'writer');
Testing
vendor/bin/phpunit