🇦🇺 Hello Australia! Sydney region is officially live on Neon.Sign Up
Guides/Languages/PHP

Connect from Laravel to Neon

Set up a Neon project in seconds and connect from a Laravel application

Laravel is a web application framework with expressive, elegant syntax. Connecting to Neon from Laravel is the same as connecting to a standalone Postgres installation from Laravel. Only the connection details differ.

To connect to Neon from Laravel:

  1. Create a Neon Project
  2. Configure the connection

Create a Neon project

If you do not have one already, create a Neon project. Save your connection details including your password. They are required when defining connection settings.

  1. Navigate to the Projects page in the Neon Console.
  2. Click New Project.
  3. Specify your project settings and click Create Project.

Configure the connection

Open the .env file in your Laravel app, and replace all the database credentials.

DB_CONNECTION=pgsqlDB_HOST=[neon_hostname]DB_PORT=5432DB_DATABASE=[dbname]DB_USERNAME=[user]DB_PASSWORD=[password]DB_SSLMODE=require

You can find all of the connection details listed above in the Connection Details widget on the Neon Dashboard. For more information, see Connect from any application.

Need help?

Join our Discord Server to ask questions or see what others are doing with Neon. Neon Pro Plan users can open a support ticket from the console. For more detail, see Getting Support.

Last updated on

Edit this page
Was this page helpful?