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.
You will need the following:
- A Neon account and a project
- PHP and Composer installed on your local machine
- Run the following command to clone the project repository:
git clone https://github.com/neondatabase/guide-neon-laravel.git
- Navigate to the project directory and install the project dependencies using Composer:
cd guide-neon-laravel
composer install
- 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]
- Run the database migrations and seed the database with sample data:
php artisan migrate
php artisan db:seed
- Start the Laravel development server:
php artisan serve
- Open your web browser and visit
http://localhost:8000
to see the Laravel application running.