Files
supabase/apps/docs/content/guides/getting-started/quickstarts/laravel.mdx
Miranda Limonczenko 1bdb8d849f docs: apply the quickstart template to the remaining quickstarts (#54502)
Closes DOCS-1616

## Problem

The remaining quickstarts don't follow the [quickstart
template](https://github.com/supabase/supabase/blob/docs/quickstart-template/apps/docs/style-guide/templates/quickstart.md)
either.

## Solution

- **Heading IDs:** each numbered step ends with the template's ID, such
as `[#create-the-client]`.
- **Heading wording:** eight headings now use the template's wording,
such as `Create the Supabase client`.
- **Style:** the prose follows the word list and elements rules.

**Not changed:** RedwoodJS, Spring Boot, and Refine. DOCS-1624 covers
them.

**Before and after:** numbered headings that use the template's wording.

| Page | Before | After |
| --- | --- | --- |
| iOS | 5/8 | 6/8 |
| Kotlin | 4/8 | 5/8 |
| Flask, Flutter, Unity | 5/7 | 6/7 |
| Expo | 6/7 | 7/7 |
| Reflex | 7/7 | 7/7 |
| Laravel | 3/7 | 3/7 |
| Rails | 3/6 | 3/6 |

**Possible errors, not changed:**

- The iOS page opens **Xcode > New Project > iOS > App**. Xcode's menu
might be **File > New > Project**.
- The Vue page says to drop a type import that `supabaseClient.ts`
doesn't have.

## Preview links

| Page | Preview |
| --- | --- |
| Flask |
[Preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/flask)
|
| Reflex |
[Preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/reflex)
|
| Expo React Native |
[Preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/expo-react-native)
|
| Flutter |
[Preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/flutter)
|
| iOS SwiftUI |
[Preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/ios-swiftui)
|
| Kotlin |
[Preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/kotlin)
|
| Unity |
[Preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/unity)
|
| Laravel |
[Preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/laravel)
|
| Ruby on Rails |
[Preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/ruby-on-rails)
|

## Review category (docs PRs only)

<!--
If this PR changes docs and you're on the Supabase team, select one
category.
PRs from forks are always reviewed as Low, so you can skip this section.
-->

- [ ] Critical: needs a review as soon as possible
- [ ] Urgent: the feature ships soon, or it's blocking something else
- [ ] Moderate: good to have soon, not urgent
- [ ] Low: get to it when you can

## Review instructions

1. Open the [Kotlin
preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/kotlin)
and click **Create the Supabase client** in the table of contents. The
URL ends in `#create-the-client`.
2. Open the [Laravel
preview](https://docs-git-docs-quickstart-rework-other-supabase.vercel.app/docs/guides/getting-started/quickstarts/laravel)
and click the **Run the database migrations** link in step 4. The page
scrolls to step 7.

## Checklist

Check all before review:

- [ ] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-12-03 14:40:59 -08:00

112 lines
3.9 KiB
Plaintext

---
title: 'Use Supabase with Laravel'
subtitle: 'Learn how to create a PHP Laravel project, connect it to your Supabase Postgres database, and configure user authentication.'
breadcrumb: 'Framework Quickstarts'
---
<AiPrompt id="laravel" />
<$Partial path="quickstart_create_project.mdx" />
Save your database password securely. You need it for the connection string.
<Admonition type="note">
This guide uses Laravel's own database tables (via Breeze and Eloquent), not the shared `instruments` sample table used by other quickstarts.
</Admonition>
## 2. Create a Laravel project [#create-an-app]
Make sure your PHP and Composer versions are up to date, then use `composer create-project` to scaffold a Laravel project.
For more information, see [Creating a Laravel project](https://laravel.com/framework/docs/installation#creating-a-laravel-project) in the Laravel documentation.
```bash
composer create-project laravel/laravel example-app
```
## 3. Set up AI tooling (optional) [#set-up-ai-tooling]
<$Partial path="quickstart_ai_tooling.mdx" />
## 4. Install the authentication template [#install-the-authentication-template]
Install [Laravel Breeze](https://github.com/laravel/breeze), a basic implementation of all of Laravel's [authentication features](https://laravel.com/framework/docs/authentication). It ships the migrations that you run in [Run the database migrations](#run-the-database-migrations).
```bash
composer require laravel/breeze --dev
php artisan breeze:install blade
```
When prompted, pass a stack name such as `blade`, `react`, or `vue`. The preceding command uses Blade templates.
## 5. Set up the Postgres connection details [#set-up-the-postgres-connection-details]
<$Partial path="quickstart_connection_string.mdx" />
```bash name=.env
DB_CONNECTION=pgsql
DB_URL=postgres://postgres.[PROJECT-REF]:[YOUR-DATABASE-PASSWORD]@[POOLER-HOST]:5432/postgres
DB_SSLMODE=require
```
The generated `config/database.php` reads `sslmode` from `DB_SSLMODE`, which defaults to `prefer`.
## 6. Change the default schema [#change-the-default-schema]
By default, Laravel uses the `public` schema. We recommend changing the schema, because Supabase exposes the `public` schema as a [data API](/docs/guides/api).
To change the schema, set the `search_path` variable in `config/database.php`.
The schema you specify in `search_path` must exist on Supabase. You can create a schema from the [Table Editor](/dashboard/project/_/editor).
```php name=config/database.php
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'laravel',
'sslmode' => env('DB_SSLMODE', 'prefer'),
],
```
## 7. Run the database migrations [#run-the-database-migrations]
Laravel ships with database migration files that set up the required tables for Laravel Authentication and User Management.
<Admonition type="note">
Laravel implements its own authentication system, so it stores your users in its `users` table instead of Supabase Auth.
</Admonition>
```bash
php artisan migrate
```
## 8. Start the app [#start-the-app]
Run the development server. Go to `http://127.0.0.1:8000` in a browser to see your app. You can also go to `http://127.0.0.1:8000/register` and `http://127.0.0.1:8000/login` to register and sign in users.
```bash
php artisan serve
```
<$Partial path="quickstart_going_to_production.mdx" />
## Next steps
Build on this app with the following resources:
- To replace Laravel's built-in authentication, learn about [Supabase Auth](/docs/guides/auth)
- [Insert more data](/docs/guides/database/import-data) into your database
- Upload and serve static files using [Storage](/docs/guides/storage)