-2

I'm loading project in localhost, my admin asked me to convert laravel 5.6 to .exe along with mysql.

I'm new in this, with no idea. Can any expert guide me....

Thanks in advance.

Samuel Henry
  • 153
  • 1
  • 3
  • 10
  • 1
    wait what, no, thats not pos- unless you want to make an installer that packs preconfigured (L/X/W)AMPP + Laravel and allow it to be deployed across machine. if its what you need, [see on this QA regarding installer](https://stackoverflow.com/q/173307/4648586) – Bagus Tesa Jul 28 '18 at 07:31
  • @BagusTesa The best option would be docker – PrashanD Jul 28 '18 at 07:36
  • @PrashanD, well, that can be one approach.. if they had the juice to run it. – Bagus Tesa Jul 28 '18 at 07:38
  • @BagusTesa Well, he could try to a cmd script to install (L/X/W)AMPP + Composer + Laravel + Populate DB, Configure Settings too I guess – PrashanD Jul 28 '18 at 07:46
  • 2
    Amazingly, a possible duplicate exists: https://stackoverflow.com/questions/9046675/convert-a-php-script-into-a-stand-alone-windows-executable – ggdx Jul 28 '18 at 07:54
  • @ggdx That's not a duplicate though. It's asking how to convert a simple PHP script to a standalone .exe, which could work, after a fashion. But this question is on a whole new level, trying to bundle a fully fledged application build from PHP, Laravel and MySQL into a windows executable. The only way you could achieve that kind of cross platform bundling would be to go with docker – PrashanD Jul 28 '18 at 07:59
  • I already saw @ggdx, If u get other relevant link kindly refer. – Samuel Henry Jul 28 '18 at 10:02
  • @PrashanD I already installed Xamp with mysql, Composer, Laravel. I'm working in it. But, still need convert it into desktop application. – Samuel Henry Jul 28 '18 at 10:07

2 Answers2

6

I'm not sure your admin should be asking you to convert a Laravel project into an exe but let's humor him for a moment:

Laravel is a framework built on top of the PHP language. While there are tools out there to convert PHP scripts to standalone .exe files:

https://www.exeoutput.com/ https://www.exeoutput.com/php-exe

I highly doubt that it will work for a framework like Laravel.

PHP + Laravel + MySQL is meant to be run on a PHP capable environment. What you need to do is install PHP, MySQL, Composer and Laravel on Windows and run your web application from that environment.

Since your "admin" and not your "project manager" asked you to make a standalone .exe, it makes me think that maybe he wanted to deploy, test and tweak your application on a bunch of different PCs, web servers or cloud environments and he thought it would be convenient to have a single deployable .exe instead of having to install PHP, MySQL, Composer, Laravel, populate the Databases and configure the web, DB servers every time he wanted to deploy and test your application.

If this is the case your best bet would be to create one or more docker containers. and hand it to your admin.

https://www.docker.com https://www.docker.com/what-container

I'm again surprised that the admin did not ask you to dockerize in the first place and instead asked you to make a windows executable out of a web application built on top of a PHP framework and an embedded MySQL database.

Also see :

https://laracasts.com/discuss/channels/general-discussion/laravel-mysql-wamp-server-project-to-exe

laravel executable application

Edit: I just realized that if you are going to try to spend time converting your application into an exe by following one of the methods in this question about convert php scripts to exe, you could perhaps at least bypass the Laravel dependency by converting the files in the Laravel storage directory instead of your source code, which contains pure PHP instead of blade templates, which most definitely will not be converted by any PHP to exe tools.

i.e.: Blade files may contain @foreach whereas the storage directory will contain transpiled pure PHP code which would replace the @foreach with

<?php $__currentLoopData = $getusergroups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $getusergroupss): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($getusergroupss->id); ?>"><?php echo e($getusergroupss->title); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

Still a long shot though.

PrashanD
  • 2,643
  • 4
  • 28
  • 58
  • But converting every .blade.php into .php is not possible. I tried with exeoutput but get no result in .exe. Simply, it load and hides @PrashanD – Samuel Henry Jul 28 '18 at 09:59
  • @SamuelHenry Well, for starters you don't need to convert .blade.php into .php yourself because you can find the converted files in the [storage directory](https://laravel.com/docs/5.6/structure#the-storage-directory) (storage/framework/views). Second, my point was even it you did convert those files in the storage directory into exe there's a very high chance it won't work, which is why you need to go with docker – PrashanD Jul 28 '18 at 10:09
  • Thanks Mr. @PrashanD I understand. Client asks for desktop application, i shall say its not possible? – Samuel Henry Jul 28 '18 at 10:15
  • 1
    @SamuelHenry If by desktop application you mean an application that can be run on the client's PC, then yes it's possible. Write one or more installer scripts to install all the dependencies (PHP, Composer, Laravel, MySQL) and make an `exe` file to run those scripts (setup.exe), make another script to start the application. If the client wants to "convert" Laravel to an exe then it's not possible – PrashanD Jul 28 '18 at 10:23
  • Im new in it, If u dont mind please give some links or ideas. Mr. @PrashanD – Samuel Henry Jul 28 '18 at 10:26
  • @SamuelHenry try this https://superuser.com/questions/288233/what-scripting-languages-are-useful-in-windows – PrashanD Jul 29 '18 at 03:44
0

If you want to test the laravel project in Desktop mode you can try with this https://github.com/cztomczak/phpdesktop

it use sqlite. So,you need to change your database eg.mysql to sqlite And you can copy and paste your project in "www" folder and try it...

It work for me.... At least you can show your admin with this and you can look more in here... https://bitbucket.org/chromiumembedded/cef/overview

Yar Zar
  • 1
  • 2