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
Cloud Bigquery

Cloud Bigquery Laravel Package

google/cloud-bigquery

Idiomatic PHP client for Google BigQuery. Create and manage datasets/tables, load data (e.g., CSV), run query jobs, and iterate results. Part of Google Cloud PHP; includes auth, debugging guidance, and full API docs.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Cloud Bigquery
How do I integrate Google BigQuery into a Laravel application without tight coupling?
Use Laravel’s service container to bind the `BigQueryClient` in `AppServiceProvider`. Inject it into controllers or services via constructor injection. This keeps your business logic decoupled from the data layer. Example: `app()->bind(BigQueryClient::class, fn() => new BigQueryClient([...]));`.
Can I use this package for real-time analytics dashboards in Laravel?
Yes, but optimize for performance by caching query results with Laravel’s `Cache` facade. For sub-second responses, pre-aggregate data in BigQuery or use materialized views. Monitor query complexity with middleware to avoid timeouts.
What’s the best way to authenticate this package in Laravel?
Store your Google Cloud credentials in `.env` (e.g., `GOOGLE_APPLICATION_CREDENTIALS=path/to/service-account.json`) and pass them to the `BigQueryClient` constructor. For production, use Laravel’s `Passport` or GCP Service Accounts with IAM roles.
How do I handle schema changes when loading data from Laravel to BigQuery?
Use BigQuery’s `INFORMATION_SCHEMA` to validate schemas before loading data. For Laravel, create migrations that sync with BigQuery tables. If schema evolution is frequent, consider a repository pattern to abstract schema logic.
Will this package work with Laravel Vapor or serverless deployments?
Yes, the package is serverless-compatible. Pair it with Laravel Vapor or Cloud Run to offload BigQuery operations to Google’s infrastructure. Use environment variables for credentials and configure BigQuery’s slot reservations for cost control.
How can I mock BigQueryClient for Laravel unit tests?
Use Laravel’s testing helpers or PHPUnit’s `Mockery` to mock the `BigQueryClient`. Bind a mock instance in your test `AppServiceProvider` or use Laravel’s `partialMock`. Example: `$this->app->instance(BigQueryClient::class, Mockery::mock(...));`.
What Laravel versions and PHP versions does this package support?
The package is GA and supports PHP 8.1+. For Laravel, it works with versions 10 and 11 (LTS). Pin dependencies in `composer.json` to avoid compatibility issues. Test thoroughly if using older Laravel versions.
How do I reduce BigQuery costs in a Laravel application?
Cache query results with Laravel’s `Cache` facade, use flat-rate BigQuery pricing for predictable workloads, and set up slot reservations. Log query costs via middleware and monitor usage with BigQuery’s INFORMATION_SCHEMA.
Can I use this package alongside Eloquent for hybrid workflows?
Absolutely. Use Eloquent for PostgreSQL/MySQL writes and BigQuery for read-heavy analytics. Example: Write user data to Eloquent, then query aggregated metrics from BigQuery in a dashboard. Abstract the logic behind a repository pattern.
Are there alternatives to this package for Laravel BigQuery integration?
For Laravel, alternatives include custom REST APIs (e.g., Google’s BigQuery REST API) or third-party wrappers like `spatie/google-cloud`. However, this official package is the most idiomatic for PHP, with built-in auth, debugging, and full API coverage.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky