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:
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.
- Navigate to the Projects page in the Neon Console.
- Click New Project.
- Specify your project settings and click Create Project.
Configure the connection
.env file in your Laravel app, and replace all the database credentials.
<hostname>the hostname of the branch's compute endpoint. The hostname has an
ep-prefix and appears similar to this:
<dbname>is the name of the database. The default Neon database is
<user>is the database user.
<password>is the database user's password.
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.