phibble

SqlTable, PolarsTable, and Laravel

Methods specific to the SQL and Polars backends, and the Laravel integration.

SqlTable

->showQuery()

$table->showQuery(): string

The SQL that collect() would run, with ? placeholders.

Method of SqlTable
Returns string
Examples phibble for Laravel developers, SQL tables

->bindings()

$table->bindings(): array

The values of the ? placeholders in showQuery(), in order.

Method of SqlTable
Returns list<mixed>
Examples SQL tables

->dialect()

$table->dialect(): Dialect

The SQL dialect the table compiles to, chosen from the PDO driver.

Method of SqlTable
Returns Dialect

Dialect::for()

Dialect::for(PDO $pdo): Dialect

The dialect for a PDO connection: SQLite, PostgreSQL, or MySQL.

Parameter Type Default Description
$pdo PDO

Static method of Phibble\Sql\Dialect
Returns Dialect
Throws InvalidArgumentException: for any other driver.

Dialect::tryFor()

Dialect::tryFor(PDO $pdo): ?Dialect

The dialect for a PDO connection, or null for a driver SqlTable does not support.

Parameter Type Default Description
$pdo PDO

Static method of Phibble\Sql\Dialect
Returns ?Dialect

PolarsTable

->polars()

$table->polars(): Phpolars\DataFrame

The underlying Polars DataFrame.

Method of PolarsTable
Returns Phpolars\DataFrame

Laravel

PhibbleServiceProvider::registerMacros()

PhibbleServiceProvider::registerMacros(): void

Register the macros; safe to call more than once.

Static method of Phibble\Laravel\PhibbleServiceProvider

->phibble()

$builder->phibble(): SqlTable

A lazy SqlTable over a Laravel query, Eloquent, or relation builder, on the builder’s connection.

Global scopes, such as soft deletes, apply. Attribute casts and accessors do not, because rows come from SQL.

On Illuminate, Illuminate, and Illuminate, after PhibbleServiceProvider::registerMacros(), which package discovery runs.

->toDataFrame()

$builderOrCollection->toDataFrame(array $types = []): DataFrame

Run a Laravel query, or read a collection, into a DataFrame.

On builders it calls DataFrame::fromQuery(); on Collection and LazyCollection it calls DataFrame::fromCollection(). $types declares column types, as in fromColumns().

On the query, Eloquent, and relation builders, Illuminate, and Illuminate, after PhibbleServiceProvider::registerMacros(), which package discovery runs.