---
title: "Getting started with Laravel and Postgres"
description: "A new Laravel app can be connected to a Supabase-hosted Postgres database in a few steps: scaffold the project with Composer, install Laravel Breeze for built-in authentication, set DB_CONNECTION=pgsql and DATABASE_URL to the Supabase pooler connection string, then run migrations and start the dev server."
url: "https://swe.quest/articles/getting-started-with-laravel-and-postgres-e9ee98d4a4f87aab"
canonical: "https://supabase.com/blog/laravel-postgres"
source: "Supabase"
published: "2024-01-22"
difficulty: "medium"
kind: "How-to"
reading_minutes: 2
tags: ["php","postgres"]
---

# Getting started with Laravel and Postgres

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2024-01-22, 2 min read, How-to. Original: [https://supabase.com/blog/laravel-postgres](https://supabase.com/blog/laravel-postgres)

## Summary

A new Laravel app can be connected to a Supabase-hosted Postgres database in a few steps: scaffold the project with Composer, install Laravel Breeze for built-in authentication, set DB\_CONNECTION=pgsql and DATABASE\_URL to the Supabase pooler connection string, then run migrations and start the dev server. One Supabase-specific tip is to change Laravel's search\_path from the public schema to a dedicated schema such as 'laravel', because Supabase exposes public through its data API. Breeze uses Laravel's own auth rather than Supabase Auth, so only database resources are billed.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PHP](https://swe.quest/tags/php.md) (Languages)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)

## Prerequisites

- PHP and Composer ([easy posts on PHP](https://swe.quest/tags/php.md?difficulty=easy))
- Laravel basics

## Keywords

Laravel, Supabase, Laravel Breeze, PostgreSQL, Composer

## Related posts

- [Getting started with Ruby on Rails and Postgres on Supabase](https://swe.quest/articles/getting-started-with-ruby-on-rails-and-postgres-on-supabase-03d6ca4747754aea.md): Supabase · 2024-01-29 · Medium · 3 min read · Ruby, PostgreSQL, Deployment
  A Rails app can be wired to a Supabase-hosted Postgres database by scaffolding with \`rails new -d=postgresql\` and supplying the Supabase pooler connection URI through the \`DATABASE\_URL\` environment variable.
- [Supabase Branching](https://swe.quest/articles/supabase-branching-4fbb0c9896d51627.md): Supabase · 2023-12-13 · Medium · 5 min read · Schema migrations, PostgreSQL, CI/CD, Deployment
  Supabase Branching gives each Git branch an isolated hosted Preview environment with its own Postgres database, Auth, Storage, Realtime, Edge Functions and APIs, plus separate credentials.
- [Supabase Local Dev: migrations, branching, and observability](https://swe.quest/articles/supabase-local-dev-migrations-branching-and-observability-770def662fe57683.md): Supabase · 2023-08-08 · Easy · 6 min read · PostgreSQL, Developer tools, Schema migrations, Testing, Deployment
  Supabase's CLI gains a batch of Postgres local-development features: \`supabase inspect db\` with 19 diagnostic commands adapted from Heroku's pg-extras, \`db dump\` backups built on pg\_dump, migration squashing and diffing via migra, pgTAP testing with \`supabase test\`, plpgsql\_check linting, seeding, and TypeScript type generation that now detects foreign-key relationships.
- [Supabase CLI](https://swe.quest/articles/supabase-cli-a62c53c7dbec808f.md): Supabase · 2021-03-31 · Medium · 7 min read · Schema migrations, PostgreSQL, Developer tools
  Supabase's new CLI runs the full Supabase stack locally via Docker Compose, using the same tooling as production, and walks through wiring it to a React app.
- [Supabase is now on Postgres 13.3](https://swe.quest/articles/supabase-is-now-on-postgres-13-3-2931acd8ef3ece75.md): Supabase · 2021-07-26 · Easy · 3 min read · PostgreSQL, Performance engineering
  New Supabase projects now run Postgres 13.3 (up from 12.0), bringing native gen\_random\_uuid, parallel index vacuuming, incremental sorting and smaller B-tree indexes.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
