This is a new tutorial where we explore how to transform a Laravel web application into a desktop application using our PHP compiler “ExeOutput for PHP” software. 👉 The full source code of the Laravel sample can be downloaded here.
Watch The Video Tutorial
Introduction to Laravel and ExeOutput for PHP
Laravel, as you might know, is an open-source PHP framework that simplifies the development of robust and elegant web applications. On the other hand, ExeOutput for PHP is a fantastic tool that compiles PHP applications into executable files for Windows. This means you can convert your web application into a standalone desktop application, eliminating the need for a local or remote web server.
Steps to Convert Your Application
1. Download the Project Application
First, we need to download the project application from the ExeOutput website. The project is available at the address indicated below in the video description. Once downloaded, extract it directly into the directory where you downloaded it. A subdirectory named “laravel” will be added. You can even complete the application with your own files later.
2. Explore the Archive Structure
Unzip the structure and explore the contents. In the directory, you will find several ExeOutput projects, a demo application, and an instruction file. The “src” directory contains the source files that we will compile into the final executable file. This step ensures that your application is easy to distribute and parts of your source code remain protected.
3. Configure ExeOutput for PHP
Now, let’s configure ExeOutput for PHP to make sure the application works correctly. Open the project in ExeOutput. The first step is to specify the output path of the executable file of our application that will be created. Go to “Application Output” and place the executable file in the parent directory of the “Data” directory. Update the path as needed.
4. Adjust Parameters
You can change the rendering engine if you wish and customize all the parameters, including the application skin. Make sure to choose PHP version 8.3, which is required for Laravel 11. Note that this only works from Windows 10 or 11, so be careful if you’re still using Windows 7.
5. Handle Routing Options
Laravel uses routing extensively. ExeOutput does not support Apache’s .htaccess files, so you need to enable the option to redirect requests from the various empty directories to the main router script index.php.
6. Configure PHP Extensions
The PHP extensions are normally pre-configured according to Laravel’s recommendations. If you need additional extensions, you can activate them with one click. For example, activate the image extension if required. No need to modify the php.ini file manually.
7. Exclude Certain Directories
For Laravel, ensure that ExeOutput does not compile all the source files. In the File Manager, exclude the “vendor”, “storage”, “public”, and “database” directories from being compiled into the executable file. This is done by selecting the directory, choosing “Properties”, and ensuring the option “Keep files external and copy them to the Data subdirectory” is enabled.
8. Compile the Application
Now, compile the application to create the executable file. Check the compilation log to ensure everything went well. The path to the application specified earlier will allow you to test it.
9. Distribute the Application
To distribute the application, use the deployment options to create an installer or export it to a zip archive. The zip archive is the fastest option. It will compress all the files, including the external files in the “Data” directory, into a single zip file that you can distribute to your clients.
10. Manage Artisan Commands
Normally, Artisan requires a PHP distribution to function. In this case, ExeOutput manages it. Use the standalone Artisan executable file provided in your application directory to run Artisan commands via the command line.
Conclusion
By following these steps, you can successfully convert your Laravel web application into a standalone desktop application using ExeOutput for PHP. This ensures your application is easy to distribute and your source code remains protected. Happy coding!
👉 Get the full source code of the Laravel sample used in this tutorial.