SqlTable, PolarsTable, and Laravel
On this page
Examples
Methods specific to the SQL and Polars backends, and the Laravel integration.
SqlTable
->showQuery()
$table->showQuery(): stringThe SQL that collect() would run, with ? placeholders.
Method of SqlTable
Returns string
Examples phibble for Laravel developers, SQL tables
->bindings()
$table->bindings(): arrayThe values of the ? placeholders in showQuery(), in order.
Method of SqlTable
Returns list<mixed>
Examples SQL tables
->dialect()
$table->dialect(): DialectThe SQL dialect the table compiles to, chosen from the PDO driver.
Method of SqlTable
Returns Dialect
Dialect::for()
Dialect::for(PDO $pdo): DialectThe 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): ?DialectThe 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\DataFrameThe underlying Polars DataFrame.
Method of PolarsTable
Returns Phpolars\DataFrame
Laravel
PhibbleServiceProvider::registerMacros()
PhibbleServiceProvider::registerMacros(): voidRegister the macros; safe to call more than once.
Static method of Phibble\Laravel\PhibbleServiceProvider
->phibble()
$builder->phibble(): SqlTableA 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 = []): DataFrameRun 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.