I used a lot of Localhost Severs for Windows like WAMP and XAMP in my development. There are both good but I found other Localhost Server Laragon which is easier to use and develop.
You can find it here Localhost Server Laragon. It’s pretty easy to use. Just download it and install it. Current Laragon versions:
What is so great about Laragon:
- It automatically creates Virtual Host for you
- Mail Catcher and Mail Sender which is very neat
- Switching PHP , Apache , MySQL and MariaDB version is a breeze
- Easy creating projects with frameworks like Laravel, Symfony, WordPress, Joomla and etc.
- Settings – you can setup your environment per your requirements very easy
Automatically creates Virtual Host
When you create new folder in Document Root folder of Laragon and start the application it automatically creates Virtual Host for you. By default the Host name is http://folder_name.dev , open the domain in your favorite browser and voila you have working domain is seconds.
Here is the preferences window of Laragon
I install it on my C drive. You can change the Document Root folder and domain extension to like loc or anything you like. It’s that easy.
Note: After you create your new folder in Document Root either restart Laragon or click Stop and then Start All. That way Laragon will find and create your new Virtual Host.
Mail Catcher and Mail Sender
When you develop web application sometimes you need to send some email to test if everything is working. Instead of using your email and fill it with test emails, Laragon offers Mail Catcher function. It will store emails send from your application and display them for 5 seconds by default. That way you can preview your emails easy and you won’t need to search them in your inbox or spam folder.
Note: Emails send with PHP mail()
Emails are kept as html or text files located in C:\install_folder\bin\sendmail\output in my case C:\laragon\bin\sendmail\output
If you want to send emails, you can use Laragon Mail Sender. It works with GMail account just put Gmail address and password and you can send emails.
Switching PHP , Apache and MYSQL version
You can change php , Apache and MySQL version very easy from Laragon menu.
Just select version and click on it. Restart Laragon and you are ready to develop.
Download and add php versions to Laragon
For php version you can find them on http://windows.php.net/download/ . You need Non Thread Safe version. Download it and and unzip it in C:\install_folder\bin\php in my case
Changing your MySQL version is also that simple.
Download and install more MySQL versions
You can find and download MySQL zip version here https://dev.mysql.com/downloads/mysql/. Download Windows (x86, 32-bit), ZIP Archive version and unzip it in C:\install_folder\bin\mysql in my case C:\laragon\bin\mysql
After that Restart Laragon in order to find new MySQL version and change it.
Note: Before that BACK UP your DATABASES!
Download and install Mariadb version on Laragon
Mariadb version you can download here https://downloads.mariadb.org/, click on latest version. For me lastest version is Download 10.1.23 Stable Now! and from inside download Windows x86 zip file. Unzip and it in C:\install_folder\bin\php in my case. Now restart Laragon and select your new version.
Note: Before that BACK UP your DATABASES!
Download and install Apache version
Here you can find and download apache http://directory.apache.org/studio/download/download-windows.html
Download Windows 32 bit zip archive and unzip it in C:\isntall_folder\bin\apache or in my case C:\laragon\bin\apache
Restart and select your favourite Apache.
Easy creating project
You can easy create new project with number of platforms and frameworks. Laragon works with github so it will always download the newest version. Platforms and Framework that are default in Laragon are:
You can also add platforms and frameworks you work with.
How to create new project with Laravel in Laragon?
- Click Menu in main window of Laragon or right click with your mouse from System Tray and click Quick Create.
- Select your platform or framework and click on it
- Give your project a name. This name will be also the name of the folder and your domain. For example if we call the new project laravel , domain will be http://laravel.dev . NOTE: Use simple names for easy of use
- Wait Laragon to do its work
- Restart Laragon and now you can access your new site
Add another Framework or Platform in Laragon (if you have composer installed)
- Open Laragon Quick Create Configuration
- Configuration file will open. This is the default Laragon Quick Create configuration
- Here I will add Framework Yii version 2. I will add this lines before line 5 “# WordPress”
Yii=composer create-project –prefer-dist yiisoft/yii2-app-advanced %s –prefer-dist
- Save the file and you are ready to develop on Yii . This is how will look your configuration file after. Symbols %s will be replace with your project name and create folder and Virtual Host for you.
- Restart Laragon so you can access new Host or Reload Apache/Ngix
If you don’t have composer installed please add this lines:
Please, folow the step for “Add another Framework or Platform in Laragon (if you have composer installed)” and add this two lines instead. Thanks to Steve!
If you are developing with IDE PhpStrom you might want to use surround with code function. There are a few key combinations:
- Ctrl + Alt + J – Surrounds with Live Template
- Ctrl + Alt + T – Surround with
If you are using Ctrl + Alt + T , Laragon will show you its Terminal. In order to prevent that you can only turn off hotkeys by editing Laragon settings file laragon.ini . You can do that by clicking Menu > Laragon > Laragon settings file: laragon.ini or by right click Laragon icon in System Tray. It will open laragon.ini , add this line UseHotKey=0 after [preferences] . Like this:
If you find any error or you want to add something, please fill free to comment.