Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mohamed Said:
The magic behind Laravel Valet
May 09, 2016 @ 10:34:19

One of the latest offerings in the Laravel ecosystem, Laravel Valet, was released this past week. It makes setup of new applications simpler and even allows tunneling back from the public web to a local system for easy sharing. In this post to his site Mohamed Said takes a look at the "magic" behind Valet and how it does what it does.

So yesterday Taylor Otwell and Adam Wathan released Laravel Valet, it's simply a tool that helps OS X users easily run their websites locally for development purposes, without the need to configure anything each time a new project needs to be created.

The idea behind valet is that it configures PHP's built-in web server to always run in the background when the operating system starts, then it proxies all requests to a given domain to point to your localhost

He starts by helping you get the tool downloaded (via Composer) and what happens when you run the valet install command. He gets into the detail of each piece that valet sets up:

  • the OS X daemon to run the PHP built-in server
  • the Valet configuration files
  • Dnsmasq (a DNS server)

He then talks about how handles the requests for your local ".dev" sites and the "drivers" it uses to decide which site to serve up.

tagged: laravel valet setup magic install behindthescenes daemon server dnsmasq

Link: http://themsaid.github.io/magic-behind-laravel-valet-20160506/

Wojciech Sznapka's Blog:
Dynamic LAMP setup for localhost development
Mar 24, 2011 @ 09:55:51

In a recent post to his blog Wojciech Sznapka shows you how to set up your local development environment so that you're not having to configure a VirtualHost (assuming you're using Apache, of course) each time you want to work on a new project.

If you are developing PHP application on your own PC, you probably have some vhost based configuration of your Apache. With some tricks, you can turn your Linux box into powerful development server without configuring vhost for every app. [..] We can ommit two lasts steps [of a typical setup process], limiting preparation of the environment only to place source code somewhere in filesystem. To achieve this we need mod_vhost_alias module for Apache2 and simple DNS server which will resolve local domain names for us.

His tip uses the mod_vhost_alias module for Apache and the dnsmasq tool to make the basic DNS server to resolve these custom domains. A few configuration changes later (included) and you're set to restart apache and be on your way.

tagged: lamp development dynamic modvhostalias dnsmasq