Weave Code
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 APIs Client Library for PHP to access services like Gmail, Drive, and YouTube from your server. PHP 8+ and Composer install supported. Library is in maintenance mode: critical bug/security fixes only, no new features.

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 project?
Run `composer require google/apiclient` in your Laravel project root. The package supports PHP 8.0+ and integrates with Laravel’s Composer dependency system. For large projects, consider running `composer install --optimize-autoloader` to reduce bundle size.
Which Laravel versions are compatible with **google/apiclient**?
The package requires PHP 8.0+, so it works with Laravel 8.x, 9.x, and 10.x. Older Laravel versions (7.x or below) may need PHP upgrades or manual adjustments for compatibility.
How do I authenticate with OAuth 2.0 in Laravel using this package?
Register the `Google_Client` as a singleton in `AppServiceProvider` and configure OAuth credentials via `setClientId()`, `setClientSecret()`, and `setRedirectUri()`. Use Laravel’s session or redirect helpers to handle OAuth callbacks securely.
Can I use service accounts instead of OAuth for server-to-server API calls?
Yes. Load your service account JSON key file via `setAuthConfig()` and set the scope (e.g., `Drive::DRIVE`). Store credentials securely in Laravel’s encrypted storage or environment variables.
How do I reduce the package size if I only need a few Google APIs?
Run `composer require google/apiclient --ignore-platform-reqs` and manually remove unused API service classes from `vendor/google/apiclient/src/`. Alternatively, use `composer cleanup` to optimize autoloading.
Is there a Laravel facade or helper to simplify API calls?
No built-in facade, but you can create one in `app/Facades/GoogleApi.php` to wrap `Google_Client` methods. Example: `GoogleApi::getDriveService()->files()->listFiles()`. This abstracts initialization logic.
How do I handle token refreshes in Laravel?
Set a token refresh callback in `Google_Client` (e.g., `setAccessToken()`) and log new tokens to Laravel’s database or cache. For async retries, dispatch a job using Laravel Queues.
Can I cache API responses in Laravel?
Yes. Use Laravel’s cache drivers (Redis, file) with PSR-6 adapters. Example: Cache a Drive file list with `Cache::put('drive_files', $response, now()->addHours(1))`. The package supports PSR-6 caching natively.
What’s the difference between **google/apiclient** and **google/cloud-*** libraries?
**google/apiclient** is a monolithic library for all Google APIs (e.g., Gmail, YouTube) but is in maintenance mode. For Google Cloud Platform APIs (e.g., Cloud Storage), use dedicated **google/cloud-*** libraries, which are actively developed.
How do I secure API credentials in production?
Store JSON key files in Laravel’s encrypted storage (`storage/app/google_credentials.json`) or use environment variables. For serverless environments, set `GOOGLE_APPLICATION_CREDENTIALS` to the path of your credentials file.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai