PHP development environment for Windows minimalists with Laragon

Introduction

Setting up a PHP server on a Windows machine can be tedious sometimes.

There are different ways of setting it up and the most popular way is downloading packages like XAMPP or Wampserver. These are really great tools which come bundled with Apache, PHP and Mysql.

Setting up a server with any of these tools will require you to open the application, start the PHP and Mysql servers. You would now need to put your project folders in the htdocs(or its equivalent) folder which is located where the application was installed. Next is to navigate to to the URL of your application which is mostly of the format localhost/[app_folder_name]

The problem

The method above doesn’t seem so bad after all but let me point out a few shortcomings

  • You don’t have a pretty URL: You can get away with this by setting up a virtual host which is actually another tedious step.
  • Both XAMPP and Wampserver come with Apache only, which means you don’t have the option of switching to another server such as NGINX.

Introducing Laragon

Laragon (as defined on it’s website) provides Super fast, easy-to-use, productive and powerful development environment for all.

If you are familiar with the laravel ecosystem then there is the chance that you have heard of a product called valet. Laragon offers similar functionalities with valet but it runs on Windows while valet runs on OSX.

Usage

To get started, visit the largon website and click on the download button. This will take you to a page containing different versions for different stacks. Pick the first one.

different versions of laragon

After going through the installation, open the app and you see something similar to the image below.

Laragon application

Click on the Root button to go to the www folder where laragon is installed. This is where you put your application folders. After copying your app folder, click on the Start All button to start your servers. You can then open your browser and navigate to the url [app_folder_name].dev So for example if we copied a folder called mywebsite to the www folder then the application url would be mywebsite.dev

This is much better than the previously mentioned approach. Anytime you create a new application, you can just go to your browser with the same URL format and your app is ready without doing anything else.

Customization

Since laragon is a GUI application, customizing it is very straight forward. All you need to do is click the settings icon at the top right corner and a settings dialog pops up.

Laragon settings

You can configure setting such as the host name. I have changed mine from .dev to .app since i learned that .dev is now a valid domain. You can also make changes like switching from apache to nginx, enabling SSL for your applications, running the application when Windows start and many others.

Conclusion

Using laragon on my Windows has been a wonderful experience. I use laravel valet on my Macbook and now I get to enjoy something similar on my Windows machine. It works well with most (I guess all) PHP frameworks and non framework applications too without any extra configuration. I have tried it with my Laravel, Codeigniter, Wordpress and Vanilla PHP applications and everything worked seamlessly.

If you are a PHP developer and you work on a Windows machine, I strongly recommend using this application. It is a great tool to have.

Thanks for reading and let me know what you think in the comments or you can hit me up on twitter.