PHPackages                             laravel-gtm/snowflake-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. laravel-gtm/snowflake-sdk

ActiveLibrary[Database &amp; ORM](/categories/database)

laravel-gtm/snowflake-sdk
=========================

Snowflake database driver for Laravel using REST API and Saloon — no PDO extension required

v0.0.3(1mo ago)050MITPHPPHP ^8.4CI passing

Since Apr 14Pushed 1mo agoCompare

[ Source](https://github.com/laravel-gtm/snowflake-sdk)[ Packagist](https://packagist.org/packages/laravel-gtm/snowflake-sdk)[ RSS](/packages/laravel-gtm-snowflake-sdk/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (11)Versions (4)Used By (0)

Snowflake SDK for Laravel
=========================

[](#snowflake-sdk-for-laravel)

[![Tests](https://github.com/laravel-gtm/snowflake-sdk/actions/workflows/tests.yml/badge.svg)](https://github.com/laravel-gtm/snowflake-sdk/actions/workflows/tests.yml)[![PHP Version](https://camo.githubusercontent.com/ee55fcc764b8da219f5728116c7edb953d689ea02eb6ae5c6f6eec916eef05ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c61726176656c2d67746d2f736e6f77666c616b652d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-gtm/snowflake-sdk)[![License](https://camo.githubusercontent.com/7eb00ed6fa2495dfccedd24fd4db1325b02d5129cb392424e9aa52c1b106794a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c61726176656c2d67746d2f736e6f77666c616b652d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-gtm/snowflake-sdk)

A Laravel database driver for Snowflake using the REST SQL API and [Saloon](https://docs.saloon.dev). No PHP extensions or ODBC drivers required.

Features
--------

[](#features)

- Pure PHP implementation using Snowflake's REST API via Saloon v4
- Full Eloquent support with models and relationships
- Laravel Query Builder with Snowflake-specific SQL
- Migrations with Snowflake-specific column types
- ULID primary keys optimized for Snowflake clustering
- Native support for VARIANT, OBJECT, and ARRAY types
- Large result set streaming via partitions
- Bearer token authentication

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 11.0+, 12.0+, or 13.0+
- Snowflake account with REST API access

Installation
------------

[](#installation)

```
composer require laravel-gtm/snowflake-sdk
```

The package will auto-register its service provider.

Configuration
-------------

[](#configuration)

### 1. Publish the config file

[](#1-publish-the-config-file)

```
php artisan vendor:publish --tag=snowflake-sdk-config
```

This creates `config/snowflake-sdk.php` with all available options.

### 2. Environment Variables

[](#2-environment-variables)

```
SNOWFLAKE_ACCOUNT=your-account-identifier
SNOWFLAKE_BEARER_TOKEN=your-bearer-token
SNOWFLAKE_WAREHOUSE=COMPUTE_WH
SNOWFLAKE_DATABASE=MY_DATABASE
SNOWFLAKE_SCHEMA=PUBLIC
SNOWFLAKE_ROLE=SYSADMIN
```

### 3. Database Configuration

[](#3-database-configuration)

Add the Snowflake connection to `config/database.php`:

```
'connections' => [
    'snowflake' => [
        'driver' => 'snowflake',
        'account' => env('SNOWFLAKE_ACCOUNT'),
        'bearer_token' => env('SNOWFLAKE_BEARER_TOKEN'),
        'warehouse' => env('SNOWFLAKE_WAREHOUSE'),
        'database' => env('SNOWFLAKE_DATABASE'),
        'schema' => env('SNOWFLAKE_SCHEMA', 'PUBLIC'),
        'role' => env('SNOWFLAKE_ROLE'),
    ],
],
```

Usage
-----

[](#usage)

### Standalone SDK Usage

[](#standalone-sdk-usage)

You can use the SDK directly without the database driver:

```
use LaravelGtm\SnowflakeSdk\SnowflakeSdk;

// Via the container
$sdk = app(SnowflakeSdk::class);

// Or create standalone
$sdk = SnowflakeSdk::make([
    'account' => 'your-account',
    'bearer_token' => 'your-bearer-token',
]);

$result = $sdk->execute('SELECT * FROM my_table LIMIT 10');
```

### Eloquent Models

[](#eloquent-models)

Add the `UsesSnowflake` trait to any model that connects to Snowflake:

```
use Illuminate\Database\Eloquent\Model;
use LaravelGtm\SnowflakeSdk\Eloquent\Concerns\UsesSnowflake;

class User extends Model
{
    use UsesSnowflake;

    protected $connection = 'snowflake';
    protected $table = 'users';
}
```

The trait automatically generates ULID primary keys and handles Snowflake timestamp formats.

### Query Builder

[](#query-builder)

```
$users = DB::connection('snowflake')->table('users')->get();

DB::connection('snowflake')->table('users')->insert([
    'id' => Str::ulid()->toLower(),
    'name' => 'John Doe',
    'email' => 'john@example.com',
]);

DB::connection('snowflake')
    ->table('events')
    ->where('payload->type', 'purchase')
    ->get();
```

### Migrations

[](#migrations)

```
use Illuminate\Database\Migrations\Migration;
use LaravelGtm\SnowflakeSdk\Schema\SnowflakeBlueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    protected $connection = 'snowflake';

    public function up(): void
    {
        Schema::connection('snowflake')->create('users', function (SnowflakeBlueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->variant('preferences');
            $table->timestamps();
            $table->clusterBy(['created_at', 'id']);
        });
    }

    public function down(): void
    {
        Schema::connection('snowflake')->dropIfExists('users');
    }
};
```

### Snowflake Column Types

[](#snowflake-column-types)

MethodSnowflake Type`id()``CHAR(26)``variant()``VARIANT``object()``OBJECT``array()``ARRAY``geography()``GEOGRAPHY``geometry()``GEOMETRY``timestampNtz()``TIMESTAMP_NTZ``timestampLtz()``TIMESTAMP_LTZ``timestampTz()``TIMESTAMP_TZ``number()``NUMBER(p,s)``identity()``INTEGER IDENTITY`### Custom Casts

[](#custom-casts)

```
use LaravelGtm\SnowflakeSdk\Casts\VariantCast;
use LaravelGtm\SnowflakeSdk\Casts\SnowflakeTimestamp;

class Event extends Model
{
    use UsesSnowflake;

    protected $connection = 'snowflake';

    protected $casts = [
        'payload' => VariantCast::class,
        'occurred_at' => SnowflakeTimestamp::class,
    ];
}
```

### Warehouse &amp; Role Switching

[](#warehouse--role-switching)

```
$connection = DB::connection('snowflake');

$connection->useWarehouse('ANALYTICS_WH');
$connection->useRole('ANALYST');
$connection->useSchema('STAGING');
```

### Transactions

[](#transactions)

```
DB::connection('snowflake')->transaction(function ($db) {
    $db->table('accounts')->where('id', 1)->decrement('balance', 100);
    $db->table('accounts')->where('id', 2)->increment('balance', 100);
});
```

### Cursors

[](#cursors)

```
foreach (DB::connection('snowflake')->table('events')->cursor() as $event) {
    // Process one row at a time
}
```

Development
-----------

[](#development)

```
composer test        # Run tests (Pest)
composer analyse     # Run static analysis (PHPStan level 8)
composer lint        # Check code style (Pint)
composer format      # Fix code style (Pint)
```

Limitations
-----------

[](#limitations)

- No savepoints (Snowflake limitation)
- No row locking (Snowflake is append-only)
- No traditional indexes (use clustering keys instead)

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance89

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

56d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/56dcbcd0139adf900f58bc19509e785e6724dadfbfcc74f9c6769432c31686cf?d=identicon)[devethanm](/maintainers/devethanm)

---

Top Contributors

[![jimbojsb](https://avatars.githubusercontent.com/u/107836?v=4)](https://github.com/jimbojsb "jimbojsb (12 commits)")[![devethanm](https://avatars.githubusercontent.com/u/53354219?v=4)](https://github.com/devethanm "devethanm (5 commits)")

---

Tags

laraveldatabaseeloquentsaloondriversnowflake

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/laravel-gtm-snowflake-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-gtm-snowflake-sdk/health.svg)](https://phpackages.com/packages/laravel-gtm-snowflake-sdk)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.0M84](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k29.9M42](/packages/kirschbaum-development-eloquent-power-joins)[ntanduy/cloudflare-d1-database

Cloudflare D1 database driver for Laravel — full Eloquent &amp; Query Builder support.

246.8k](/packages/ntanduy-cloudflare-d1-database)[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

592452.8k2](/packages/spiritix-lada-cache)[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M16](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
