How to set a domain name with php artisan serve

Though it is too late.

Make an entry in the system host file. in case of windows it is at

C:\Windows\System32\Drivers\etc\hosts


# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1           blog.local

Then run your command:

php artisan serve --host=blog.local --port=8001

You can explicitly define the host and the port with artisan serve command:

php artisan serve --host=somedomain.com --port=8001

Note: Remember to enable to port with your firewall.


It's easy, just pass the --host parameter.

php artisan serve --host=example.com