Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lemmon's avatar
Level 28

PHP artisan serve for developing on a mac

Hello, I just got a macbook pro m3 and i was going to checkout valet but then I realized that I would have to use ngenx and I want to use apache so I will just use php artisan serve to develop laravel. with mailhog and php unit etc Question: is there any drawbacks to using php artisan serve to devleop laravel on the mac?

0 likes
13 replies
LaryAI's avatar
Level 58
Hello,

Using `php artisan serve` is a convenient way to start a development server for Laravel applications without the need for setting up a full web server like Nginx or Apache. However, there are a few considerations to keep in mind when using the built-in server for development:

1. **Performance**: The built-in PHP server is not designed for production use and may not perform as well as a dedicated web server like Nginx or Apache. For development purposes, it should be sufficient, but you might notice slower request handling for more complex applications.

2. **Features**: The PHP built-in server is quite basic and lacks many features that you might find in Nginx or Apache, such as advanced caching, URL rewriting, and load balancing. If your application relies on specific web server features, you might not be able to replicate the production environment accurately.

3. **Concurrency**: The built-in server is single-threaded, which means it can only handle one request at a time. This could be a limitation if you are trying to simulate multiple users or need to handle concurrent requests during development.

4. **Compatibility**: While `php artisan serve` is generally compatible with most Laravel features, there might be edge cases or specific configurations that don't work as expected compared to a traditional web server setup.

5. **Environment Differences**: There might be differences between your local development environment using `php artisan serve` and your production environment. This could lead to unexpected behavior when deploying your application.

6. **Mailhog and PHPUnit**: You can still use Mailhog for testing email functionality and PHPUnit for running your tests while using `php artisan serve`. These tools are independent of the web server you use.

In summary, `php artisan serve` is a great tool for quick development and testing. However, for a more robust and closer-to-production setup, you might want to consider using Laravel Valet, which is tailored for macOS and uses Nginx under the hood. If Apache is a must for you, you can configure a local Apache server or use tools like MAMP that provide an Apache, MySQL, and PHP stack for macOS.

Remember that the choice of development environment should match your needs and preferences. If `php artisan serve` meets your requirements and you're comfortable with its limitations, it's a perfectly valid option for developing Laravel applications on a Mac.

I hope this helps!

Best regards,
LaracastsGPT
nexxai's avatar

Why don't you want to use Nginx? What are you expecting Apache to give you that Nginx won't? And then after all that, why do you care about Nginx or Apache if you're just going to use php artisan serve?

Why not enable easy mode and just use Laravel Herd? It does literally all of the stuff Valet does for you, except it manages the HTTP server entirely without you having to manage any of it?

1 like
lemmon's avatar
Level 28

@Snapey I just want a LAMP on my mac that I can duplicate on digital ocean droplet later when I deploy. nothing fancy for now. This is my first mac, still chewing on that to get started. Tried homebrew to install httpd and that was a permission nightmare for me. Off to check out HERD.

Snapey's avatar

@lemmon I was just re-iterating what @nexxai advised.

Personally, I develop on herd locally and deploy to Lamp stack. There is nothing coded in my application that knows or cares about the production stack

2 likes
lemmon's avatar
Level 28

@Snapey do you use the paid Version. Do you have to deal with Enginx At all

kokoshneta's avatar

@lemmon I use the free version of Herd, and it’s very limited how much I’ve had to deal with Nginx – and the very minor stuff I did have to do was because it’s for an app that’s on a shared host with an unusual folder structure that I then needed to replicate locally and make sure Nginx had the right, non-default folders.

For an app you just want to deploy to a DO droplet, you don’t need to fiddle with Nginx at all. Complete plug’n’play.

1 like
martinbean's avatar

I want to use apache so I will just use php artisan serve

@lemmon Eh? php artisan serve is neither Apache, too.

I work across two Apple Silicon MacBooks and just use Docker and Sail. The M2 and M3 chips are more than fast enough to make working with Docker no longer a chore like it was on Intel-based Macs.

I’ve also aliased php and composer commands to functions that run the given command in a Docker container:

composer () {
	docker run --interactive --rm --tty --volume $PWD:/app composer $*
}

php () {
	docker run --interactive --rm --tty --volume $PWD:/src --workdir /src php:${PHP_VERSION:-8.3}-cli php $*
}
1 like
lemmon's avatar
Level 28

@martinbean I do not need containers for the little apps I am building, Although docker is the reason I am giving mac a chance because I spent 2 weeks trying to make WSL2 and docker function. What a mess that was. If I need containers I may give it another chance on this mac.

martinbean's avatar

@lemmon All the aliases do, is run PHP using the php image instead of a binary on your computer. It means you don’t need to install things like PHP and Composer on your Mac and have to keep messing about with different versions when swapping between projects.

So I can run php whatever to run a command using PHP 8.3 by default, or prefix it with a variable to run a command using a different version of PHP, such as PHP_VERSION=8.1 php whatever. A container is created, the command ran inside it, and then removed (what the --rm option is for). Projects themselves do not need to be “Dockerized” in order to run commands like this in containers.

1 like
lemmon's avatar
Level 28

@martinbean That sounds interesting I will look into that, now that I have a mac I do not have to fight with WSL2 on windows. Can you please lead me to some documentation Thanks

Please or to participate in this conversation.