Deploy Laravel application with a database to Heroku


PHP Laravel knowledge.

Create a Laravel Application

The composer create-project command is one of the ways you can bootstrap a new project based on the laravel/laravel. However, I am using which is having an Admin dashboard on the web and RESTful API for consumers in Laravel 8 — Jetstream, Livewire, Sanctum, and Tailwind.

Initialize a Git repository

It’s now time to initialize a Git repository and commit the current state, to do so run the following commands:

Create Procfile file

Heroku will launch an Apache/Nginx web server together with PHP to serve applications from the root directory of the project.

Login to Heroku CLI

Now you need to log into Heroku to push the project. Type following command:

Create a new application on Heroku

To create a new Heroku application that you can push to, use the heroku create command:

heroku config vars
heroku config vars
Heroku Config Vars

Add Database

You can add any database of choice. However, I am using PostgreSQL because it is available free.

add database
add database
Add database
Dashboard — Resource
heroku run bash
php artisan migrate

Software Developer @