byerikas / eloquent-bigquery
Simple BigQuery wrapper in the style of Laravel's Eloquent
1.0.0
2026-03-16 12:17 UTC
Requires
- google/cloud-bigquery: ^1.0
- laravel/framework: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^10.0
- pestphp/pest: ^4.0
README
Simple BigQuery SQL generator and query service in the syntax style of Laravel's Eloquent for Google BigQuery.
Installation
The package can be installed using:
composer require byerikas/eloquent-bigquery
Configuration
Before using it's recommended to define the default BigQuery client config in your AppServiceProvider.php:
use ByErikas\EloquentBigQuery\Facades\QueryService; QueryService::setClientConfig(["keyFile" => ...]);
As well as register any custom / complex select metrics that you may be storing elsewhere:
use ByErikas\EloquentBigQuery\Facades\MetricsRepository; MetricsRepository::from([["keyword" => "metric-1", "value" => "ROUND(..."]]);
the MetricsRepository::from() method accepts array of arrays or a Collection of arrays, and must have the following structure:
$metrics = [ [ "keyword" => "metric-1", "value" => "ROUND(..." ] ];
keyword is used to get the metric, and as the metric's alias in SQL, and the value defines the actual SQL that is inserted.