Installing Laravel with Herd
Laravel is written in PHP, so before your first page you need PHP itself, Composer (PHP's package manager), a web server and usually Node for building CSS and JavaScript. Installing and wiring these by hand used to eat an afternoon. Laravel Herd does it in one download for macOS and Windows.
The rule
Install Herd once; every folder in ~/Herd becomes a .test site.
Herd is a desktop app. Installing it gives you, already configured:
- PHP, and you can switch versions from the Herd menu.
- Composer, for installing PHP packages.
- The
laravelinstaller command, for creating projects. - Node and npm, for front-end assets.
- A web server that serves your projects automatically.
The key idea is the parked folder. By default it is ~/Herd (your home folder, then Herd). Herd serves every folder inside it at an address made from the folder name plus .test:
cd ~/Herd
laravel new lendly
# now open http://lendly.testYou do not start a server or edit any config. The folder lendly simply becomes lendly.test.
Two more commands help when your code lives somewhere else:
herd parkin a folder makes that folder a parked folder too, so every project inside it is served.herd linkinside a single project serves just that project, named after its folder.
The free version of Herd covers everything in this course. The paid Herd Pro adds extras such as bundled database and mail-testing services.
Not using Herd? The route still works: install PHP and Composer yourself, create the project, then run php artisan serve, which starts a development server at http://127.0.0.1:8000.
The shortcut
To predict a Herd address, take the folder name and add .test. To check whether a site will appear at all, ask "is it inside a parked folder, or linked?"
~/Herd/lendly
Inside the default parked folder. Address:
http://lendly.test.
The trap is creating a project in your Downloads folder and wondering why .test shows nothing. Herd only serves what it has been told about.
Drills
Answer fast — trust the rule.
A project sits at ~/Herd/shelf. What address does Herd give it?
Which of these does Herd NOT install for you?
Your project is at ~/work/lendly, outside any parked folder. What serves it with Herd?
Without Herd, which command starts a development server for a Laravel project?
Remember
- Install Herd once, and every folder in
~/Herdbecomes a.testsite. - Address = folder name +
.test, only for parked or linked folders. - Trap: projects outside a parked folder stay invisible until you link or park them.
