Web development with PHP build in server and Browser-sync

Jelle Hak
Nov 22, 2019

Tired of setting up the build environment. Luckily recent versions of PHP come with a build-in server, which makes it easier than ever to get started programming.

With some simple CLI commands you be up and running instantly.

To keep things tidy I mostly use a package.json to store the needed commands. Just add the following two script lines to your package.json file. ( or use them directly… )

"scripts": {
"start": "php -S 127.0.0.1:8000",
"dev": "npm run start | browser-sync start -p 127.0.0.1:8000 -f ."
}

then run npm run dev to get a PHP server with hot reloading. That’s it.

--

--