A local PHP development environment on a Mac needs five pieces: PHP itself (usually several versions side by side), a web server wired to PHP-FPM, a database, HTTPS on a usable local domain, and somewhere for outgoing mail to land. You can assemble those by hand with Homebrew, adopt a managed app that does it for you, or put the whole stack in Docker. This guide covers all three, with Laravel as the running example — the same setup serves WordPress, Symfony or plain PHP.
Option 1: Homebrew, assembled by hand
brew install php@8.4 mysql
brew services start php@8.4
brew services start mysql
cd myapp && composer install
php artisan serve # http://127.0.0.1:8000This gets a Laravel app serving in ten minutes, and for one project on one PHP version it's genuinely fine. The cracks appear with the second project: client A is on PHP 8.2, client B on 8.4, and Homebrew's link/unlink dance becomes a ritual. Then you want https://myapp.test instead of a port number — which means mkcert, dnsmasq and an nginx config (the full manual setup is its own guide: Local HTTPS with .test domains on macOS). Mail capture means installing Mailpit. None of it is hard; all of it is maintenance.
Option 2: Docker
Laravel Sail and hand-rolled Compose files solve version isolation completely — and pay for it with a Linux VM on macOS: slower file I/O on big vendor trees, idle memory, cold starts. If your production deps are Linux-only it can be worth it; for typical PHP web work it usually isn't. The trade is examined honestly in A Docker alternative for local development on macOS.
Option 3: a managed native environment
The middle path — native speed, zero assembly — is an app that manages runtimes and services for you. The macOS options:
- Laravel Herd — excellent for PHP, Laravel-first; databases, mail and many extras sit behind the paid tier.
- Valet — minimal and scriptable, but it's a layer over your own Homebrew PHP, so the version juggling stays yours.
- MAMP — the long-running classic; shows its age in domains and HTTPS.
- ServBay — polyglot and capable, subscription-licensed.
- PortBay — free and open source; PHP-FPM versions side by side, plus Node, databases, HTTPS, mail and tunnels in one app — and a task board that dispatches AI coding agents into the running project.
The Laravel walkthrough, managed-native style
What the five pieces look like in PortBay, end to end:
- Add the project. Point PortBay at the Laravel folder (or an empty one) and press play. It detects the framework, pins the right PHP version for that project, and serves it at
https://myapp.testwith a trusted certificate — no hosts file, no nginx config. - Database in one click. Create a per-project MySQL or PostgreSQL database; the connection string lands in
.env. Runphp artisan migrateand go. - Mail is already caught. Password resets, notifications — everything
Mail::send()produces shows up in the built-in local inbox instead of a real mailbox. - Second project, different PHP. Add it the same way; it gets its own runtime version, domain, certificate and database. Nothing global changed, nothing to unlink.
- Show a client. One click opens a Cloudflare tunnel — a public HTTPS URL to your local site, no deploy.
Coming from Herd, ServBay or MAMP? The import is automated — PortBay migrates existing sites in one click.
The 2026 wrinkle: your environment now has two users
A modern PHP setup isn't just for you anymore — it's for the AI coding agents working in your repo. An agent implementing a Laravel feature needs what you need: a database for migrations, a real HTTPS URL to load, an inbox to check the email it just wired up. PortBay's task board dispatches Claude Code, Codex, Cursor or Antigravity into that running environment — assign a card, get a verified change back (how to assign tasks to coding agents covers the workflow). If agents are part of your week, pick the environment both of you can use.
Recommendation
One project, one PHP version, no agents: Homebrew by hand is fine. Linux-only production dependencies: Docker, with eyes open. Everything else — multiple projects, multiple PHP versions, real domains, a database, mail, and possibly an agent or three — a managed native environment wins on both speed and upkeep, and PortBay is the free, open-source way to get the whole list in one app.
