box-project / box

📦🚀 Fast, zero config application bundler with PHARs.
https://box-project.github.io/box
MIT License
1.1k stars 101 forks source link

Does the box support laravel? If so, can a box.json be provided? #1368

Open zh7314 opened 2 months ago

zh7314 commented 2 months ago

Does the box support laravel? If so, can a box.json be provided? I have tried many times but have failed

theofidry commented 2 months ago

I thought there was a doc entry for it, but looks like there is only a Symfony one.

To answer your question though, yes Laravel is supported. There should not be any framework that inherently cannot be supported. There is a few caveats of course, but it has more to do with PHARs than Box:

I think most of of what is written in the Symfony doc goes for Laravel, and as a matter of fact there is LaravelZero which is a more tailored distribution of Laravel for CLI applications and it uses Box for its compilation.

zh7314 commented 2 months ago

Thank you. I tried the documentation about Symfony, but it still failed. I will try LaravelZero

yoramdelangen commented 1 month ago

It is possible with Laravel, currently working on a project at work that uses Laravel within a PHAR for over 2 years now. There are some quirks and workarounds required! The most important one to overcome is realpath.

I 'patch' certain Laravel dependencies via a custom Application and inject/override specific files, try to leave as much as possible intact. So whenever we need to update libraries I hardly have to update patches what-so-ever.