Download the PHP package sereny/postgrest without Composer
On this page you can find all versions of the php package sereny/postgrest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package postgrest
Sereny/PostgREST
A PostgREST connection driver for Laravel Eloquent. It lets your Eloquent models perform queries against a PostgREST server over HTTP, without a direct PostgreSQL/PDO connection from your app.
Under the hood it translates the Laravel Query Builder into PostgREST HTTP requests:
Requirements
- PHP 8.3+
- Laravel 12 or 13 (via
illuminate/database&illuminate/support) - A running PostgREST server
Installation
The service provider is auto-registered via package discovery.
Configuration
1. Add the connection to config/database.php
2. Publish the package config (optional)
The published file (config/postgrest.php) holds client defaults
(base_uri, schema, prefix, token, headers, timeouts). Values in the
database.php connection entry override these defaults.
3. Environment variables
Usage
Point your models at the PostgREST connection. The simplest way is to make it the application's default connection:
Or set it per model:
The raw Query Builder is also available through the connection:
Stored procedures (aggregates, custom logic) are available through rpc():
Many-to-many relationships use PostgREST resource embedding (instead of SQL
joins). Extend the bundled model (or override newBelongsToMany() yourself):
The pivot table must have foreign keys to both related tables (a requirement
of PostgREST resource embedding). attach/detach/sync write to the pivot
table over the same connection.
Three-level relationships (hasManyThrough) use nested embedding:
Feature support
| Feature | Supported |
|---|---|
select / where (=, >, >=, <, <=, !=) |
✅ |
whereIn / whereNotIn |
✅ |
whereNull / whereNotNull |
✅ |
whereBetween |
✅ |
orWhere / nested where() groups |
✅ |
like / ilike (% is translated to *) |
✅ |
orderBy (multiple, asc/desc) |
✅ |
limit / offset / simplePaginate |
✅ |
count() (via Prefer: count=exact) |
✅ |
exists() |
✅ |
insert / insertGetId / update / delete |
✅ |
paginate() (count + slice) |
✅ |
| Soft deletes | ✅ |
hasOne / hasMany / belongsTo / morph relations |
✅ |
belongsToMany (via resource embedding) |
✅ |
hasManyThrough (via nested embedding) |
✅ |
sum / avg / min / max |
⚠️ via rpc() to a database function (or a view) |
groupBy / having / distinct |
❌ (not exposed by PostgREST — use a view) |
increment / decrement / raw expressions |
❌ (not exposed by PostgREST — use computed fields or RPC) |
| Transactions | ❌ (PostgREST runs one transaction per request; no multi-request transactions) |
| Schema builder / migrations | ❌ (run DDL directly on PostgreSQL) |
rpc() to call stored procedures |
✅ |
For anything marked ❌ or ⚠️, the idiomatic PostgREST approach is a database view, a function exposed as a route, or resource embedding for related resources.
Testing
License
MIT
All versions of postgrest with dependencies
guzzlehttp/guzzle Version ^7.8
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
spatie/laravel-package-tools Version ^1.16