Some clients or users prefer to run their applications as a desktop application that is a .exe
.
In this shot, we will learn how to convert a Laravel application to a desktop application.
Download and extract the PHP desktop package from Github. This package comes with PHP version 7.1.3 and Chrome 57. The name of the file should look like phpdesktop-chrome-57.0-rc-php-7.1.3.zip
.
settings.json
Edit the settings.json
file.
You will see the settings.json
file within the extracted file’s root directory. Replace the web_server
section with the code below:
"web_server": {
"listen_on": ["127.0.0.1", 0],
"www_directory": "www/public",
"index_files": ["index.php"],
"cgi_interpreter": "php/php-cgi.exe",
"cgi_extensions": ["php"],
"cgi_temp_dir": "",
"404_handler": "/index.php",
"hide_files": []
}
Note: The changes above are made to configure the 404_handler to
index.php
for our Laravel application since.htaccess
is not supported by PHP desktop.
In the file you downloaded and extracted, open the www
folder, delete every file there, and transfer your Laravel application into the www
folder.
Run your Laravel application. Click on the phpdesktop-chrome.exe
file to execute your application.