byerikas/eloquent-bigquery

Simple BigQuery wrapper in the style of Laravel's Eloquent

Maintainers

Package info

github.com/byErikas/eloquent-bigquery

pkg:composer/byerikas/eloquent-bigquery

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-03-16 12:17 UTC

This package is auto-updated.

Last update: 2026-03-16 12:18:26 UTC


README

tests Status Packagist Version GitHub License

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.