Download the PHP package nomansheikh/laravel-bigquery-eloquent without Composer
On this page you can find all versions of the php package nomansheikh/laravel-bigquery-eloquent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nomansheikh/laravel-bigquery-eloquent
More information about nomansheikh/laravel-bigquery-eloquent
Files in nomansheikh/laravel-bigquery-eloquent
Package laravel-bigquery-eloquent
Short Description Query Google BigQuery tables with Laravel Eloquent.
License MIT
Homepage https://github.com/nomansheikh/laravel-bigquery-eloquent
Informations about the package laravel-bigquery-eloquent
Laravel BigQuery Eloquent
Overview
Laravel BigQuery Eloquent is a Laravel package that seamlessly integrates Google BigQuery with Laravel's Eloquent ORM. It enables you to query BigQuery tables using familiar Eloquent syntax, simplifying analytics and data querying directly within your Laravel applications.
Features
- Eloquent Integration: Use BigQuery tables as Eloquent models.
- Dedicated BigQuery Driver: Optimized database driver for BigQuery.
- Automatic Fully Qualified Table Names: Handles
project.dataset.table
formatting transparently. - Custom Query Grammar: Generates SQL optimized for BigQuery syntax.
- Read-Only Support: Supports SELECT queries (read operations only).
- Flexible Authentication: Supports Application Default Credentials (ADC) and service account key files.
- Environment Configuration: Easy setup via environment variables.
Requirements
- PHP 8.3 or higher
- Laravel 10.x, 11.x, or 12.x
- Access to Google Cloud BigQuery API
- Google Cloud authentication (Application Default Credentials recommended)
Installation
Install the package via Composer:
Configuration
1. Publish the configuration file
Run the following Artisan command to publish the package config:
2. Authentication Setup
The package supports Google Cloud's recommended authentication hierarchy:
-
Recommended: Application Default Credentials (ADC)
- Local development: Run
gcloud auth application-default login
- Production: Use a service account attached to your compute instance or set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable.
- Local development: Run
- Alternative: Service Account Key File
- Download a JSON key file from Google Cloud Console.
- Set the
BIGQUERY_KEY_FILE
environment variable pointing to the JSON file (not recommended for production).
Authentication Hierarchy
The Google Client library authenticates in this order:
key_file
specified in the database config.GOOGLE_APPLICATION_CREDENTIALS
environment variable.- Default credential file locations.
- Google App Engine built-in service account.
- Google Compute Engine built-in service account.
- Direct credentials array in config.
Example direct credentials array in config/database.php
:
3. Environment Variables
Add the following to your .env
file:
4. Database Connection
Add the BigQuery connection in config/database.php
:
Usage
Models
Create models by extending BigQueryModel
to interact with BigQuery tables:
Overriding Dataset
You can override the default dataset either by setting the $dataset
property or dynamically:
Queries
Perform queries using familiar Eloquent methods:
JSON Support
Query JSON fields using BigQuery's JSON functions:
Raw Queries
Execute raw SQL queries directly via the BigQuery connection:
Limitations
- BigQuery Specific: Designed specifically for Google BigQuery and may not be compatible with other database drivers.
Testing
Run the test suite with:
Contributing
Contributions are welcome! Please see CONTRIBUTING for guidelines.
Security
If you discover any security vulnerabilities, please report them via our security policy.
Credits
- Noman Sheikh
- All Contributors
License
This package is open-source software licensed under the MIT License.
All versions of laravel-bigquery-eloquent with dependencies
google/cloud-bigquery Version ^1.34
illuminate/contracts Version ^10.0||^11.0||^12.0
spatie/laravel-package-tools Version ^1.16