apps/docs/content/guides/getting-started/quickstarts/laravel.mdx
<$Partial path="quickstart_db_setup.mdx" />
Make sure your PHP and Composer versions are up to date, then use composer create-project to scaffold a new Laravel project.
See the Laravel docs for more details.
composer create-project laravel/laravel example-app
Supabase's Agent Skills is a curated set of instructions that give your AI agent procedural knowledge about working with Supabase.
Install them so your AI coding agent can produce more accurate, reliable code using current Supabase patterns, such as authentication, server-side rendering, and database migrations, rather than relying solely on training data.
To install, run the following command in the root of your project:
npx skills add supabase/agent-skills
Install Laravel Breeze, a basic implementation of all of Laravel's authentication features.
composer require laravel/breeze --dev
php artisan breeze:install
Navigate to your project dashboard and click on Connect.
Look for the Session Pooler connection string and copy the string. You will need to replace the Password with your saved database password. You can reset your database password in your Database Settings if you do not have it.
<Admonition type="note">If you're in an IPv6 environment or have the IPv4 Add-On, you can use the direct connection string instead of Supavisor in Session mode.
</Admonition>DB_CONNECTION=pgsql
DB_URL=postgres://postgres.[PROJECT-REF]:[YOUR-PASSWORD]@aws-[REGION].pooler.supabase.com:5432/postgres
By default Laravel uses the public schema. We recommend changing this as Supabase exposes the public schema as a data API.
You can change the schema of your Laravel application by modifying the search_path variable app/config/database.php.
The schema you specify in search_path has to exist on Supabase. You can create a new schema from the Table Editor.
'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' => 'require',
],
Laravel ships with sslmode set to prefer, which sends your data in plaintext if the encrypted attempt fails. Set it to require so the connection fails instead. You can also enforce SSL on the database side.
Laravel ships with database migration files that set up the required tables for Laravel Authentication and User Management.
Note: Laravel does not use Supabase Auth but rather implements its own authentication system!
php artisan migrate
Run the development server. Go to http://127.0.0.1:8000 in a browser to see your application. You can also navigate to http://127.0.0.1:8000/register and http://127.0.0.1:8000/login to register and log in users.
php artisan serve