Skip to content

neondatabase/guide-neon-laravel

Repository files navigation

Running Neon database migrations in a Laravel project

This application is a simple PHP application built using the Laravel framework and Neon database. It returns a list of authors and books written by them. This project uses the built-in Eloquent ORM to interact with the database and generate/run migrations.

To build this project from scratch, check out the guide in Neon's documentation.

Set up Locally

You will need the following:

  • A Neon account and a project
  • PHP and Composer installed on your local machine
  1. Run the following command to clone the project repository:
git clone https://github.com/neondatabase/guide-neon-laravel.git
  1. Navigate to the project directory and install the project dependencies using Composer:
cd guide-neon-laravel
composer install
  1. Create a .env file in the root of the project (you can start with the .env.example file) and update the following variables:
DB_CONNECTION=pgsql
DB_PORT=5432
DATABASE_URL=[YOUR_NEON_POSTGRES_CONNECTION_STRING]
  1. Run the database migrations and seed the database with sample data:
php artisan migrate
php artisan db:seed
  1. Start the Laravel development server:
php artisan serve
  1. Open your web browser and visit http://localhost:8000 to see the Laravel application running.

About

Example guide for Neon with Laravel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published