Streamlining Laravel Developer Onboarding with a Makefile and Herd Pro

3 min read

One of Laravel’s greatest strengths has always been the developer experience. From installing packages to integrating with third-party services, Laravel is expressive, intuitive, and polished.

Back in the days of Homestead, I admired how easily Laravel could be spun up locally. So much so, I built my own version for Magento, called Magestead. Fast forward to today, and we’ve transitioned to more elegant and native tooling. For me and many others, Herd Pro is now the go-to local development environment.

Herd Pro makes managing services like MySQL, Redis, Meilisearch, and Laravel Reverb effortless, and supports project-level configurations through a herd.yml file.

Why Onboarding Matters

While Herd simplifies setup, onboarding new developers can still involve many manual steps—installing dependencies, configuring the environment, and seeding the database.

The goal? Clone the repo, run one command, and you’re up and running. This is where a Makefile shines.

What Is a Makefile?

At its core, a Makefile is a file containing rules for automating repetitive shell commands. Ideal for onboarding, it reduces multi-step instructions to a single, predictable command.

Here’s an example of a Makefile in the root of your Laravel project:

.PHONY:: install

install::
 @(herd init)
 @(composer install)
 @(npm ci)
 @(npm run build)
 @DIR=$$(basename $$(pwd)); \
 mysql -h 127.0.0.1 -uroot -e "CREATE DATABASE IF NOT EXISTS $${DIR}"
@(phpartisanmigrate:fresh:fresh --seed)

update::
 @(composer install)
 @(npm ci)
 @(npm run build)

One Command Setup

For a new developer, setup is as simple as:

git clone {repo} {dir}
cd {dir}
make install

Let’s break it down:

herd init

  • Read your herd.yml config
  • Copies .env.example to .env
  • Installs all defined services

Example output:

INFO  PHP 8.4 is installed.
INFO  Site is secured.
INFO  Mysql is running on port 3306
INFO  Redis is running on port 6379
DONE  Your application is ready to go!

Composer & NPM

Next, we install back-end and front-end dependencies:

composer install
npm ci
npm run build

With Herd Pro, managing Node versions is automatic via your .nvmrc file.

Auto-Creating the Database

@DIR=$$(basename $$(pwd))
mysql -h 127.0.0.1 -uroot -e "CREATE DATABASE IF NOT EXISTS $${DIR}"

This line uses the current folder name as the database name—ideal if you’re following a convention where each project directory matches your .env DB name.

Swap mysql for psql or other commands if you’re using PostgreSQL or SQLite.

App Key, Migrations & Seeds

We assume there’s no app key, so we generate one:

php artisan key:generate
php artisan migrate:fresh --seed

At this point, a developer can load the app in their browser and log in with default seeded credentials.

Keeping Things Updated

We also include an update command:

make update

This handles:

  • Composer/NPM dependency syncing
  • Rebuilding frontend assets

Useful for returning developers unsure of what's changed.

Conclusion

By introducing a simple Makefile, you can transform a 15-step onboarding guide into a single make install. Combined with Herd Pro, it ensures Laravel developers spin up consistent, working environments in minutes.

It improves productivity, reduces errors, and maintains parity across your team—no more "works on my machine" problems.

Laravel
Herd Pro
Makefile
Developer Onboarding
PHP
Steven Richardson
Steven is a software engineer with a passion for building scalable web applications. He enjoys sharing his knowledge through articles and tutorials.