Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Apiclient Laravel Package

google/apiclient

Official Google PHP client library for working with Google APIs like Gmail, Drive, and YouTube on your server. Composer-installable, requires PHP 8.0+, and covers critical bug and security fixes in maintenance mode.

View on GitHub
Deep Wiki
Context7

A PHP client library for accessing Google APIs

Frequently asked questions about Apiclient
How do I install google/apiclient in a Laravel application?
Run composer require google/apiclient in your project root. If Composer times out, raise the process timeout with COMPOSER_PROCESS_TIMEOUT=600 or the config process-timeout setting. Then bind Google\Client as a singleton in a service provider, backed by a config file for credentials path, scopes, redirect URI, and cache store.
Does google/apiclient work with Laravel 10 and Laravel 11?
Yes. The library requires PHP 8.0 or higher and Guzzle 6.5.8 or 7.4.5+, which align with Laravel 9 through 11, so there is no platform blocker. Remember it is a framework-agnostic SDK, not a Laravel package, so you write a thin adapter yourself; there is no service provider, facade, or config publishing.
What is the difference between google/apiclient and googleapis/google-cloud-php?
Use google/apiclient for Workspace and consumer Google APIs such as Gmail, Drive, Calendar, Sheets, and YouTube. For Google Cloud Platform infrastructure services like Datastore, Cloud Storage, Pub/Sub, and Compute Engine, Google recommends the googleapis/google-cloud-php libraries instead. Do not install both for the same API surface.
How do I authenticate google/apiclient with a service account in Laravel?
Create a service account in Google Cloud, download the JSON key, and keep it in an environment variable or secret manager rather than the repository. Configure the client with setAuthConfig and setScopes, and use setSubject only when domain-wide delegation is required. Note that service accounts are unsupported on some APIs such as YouTube, which forces per-user OAuth.
How should I store and refresh Google OAuth tokens in Laravel?
Persist tokens through a PSR-6 cache adapter or a dedicated database table, and use setTokenCallback to capture refreshed access tokens. Guard the refresh with Laravel atomic locks so concurrent queue workers cannot race on the same token. Never commit refresh tokens or credential files to version control.
google/apiclient is in maintenance mode, what does that mean for my project?
Google will fix critical bugs and security issues but will not add new features. New API surfaces may lag or never appear in the wrapper, which caps your roadmap flexibility. Pin google/apiclient-services explicitly in composer.json because autogenerated wrappers can ship breaking changes.
How do I reduce vendor bloat from google/apiclient-services in Composer?
The library ships 200+ service wrappers that inflate vendor/, autoload, and opcache unless you prune them. Configure the Google\Task\Composer::cleanup script in your composer.json to remove unused services, and watch for the documented pitfall where services are deleted under vendor/google/apiclient-services. Also pin the apiclient-services version so pruning does not break silently.
How do I test Laravel code that calls Google APIs without hitting the real endpoints?
Wrap each API behind a domain adapter, for example App\Services\Google\DriveGateway, that returns your own DTOs instead of autogenerated models. Bind that interface in the container and substitute a fake in tests. This isolates the autogenerated models, improves static analysis, and preserves your exit path if the library stalls.
Can I use google/apiclient for Gmail and Drive with restricted scopes in production?
Yes, but restricted scopes such as full Gmail or Drive access require Google OAuth verification and a CASA security assessment before you can ship to external users. Expect weeks to months of lead time, real cost, and annual renewal. Budget and schedule the compliance work alongside the technical integration.
What are the alternatives to google/apiclient for a Laravel app?
Community packages like pulkitjalan/google-apiclient wrap the official client in Laravel conventions, but they carry their own maintenance risk. A thin internal wrapper around Google\Client is often preferable because the integration surface is small. If the library stalls, the exit path is google/auth plus raw Guzzle, so keep your adapters and DTOs decoupled from generated models.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource