Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zh7314 opened this issue May 14, 2024 · 3 comments
Open

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

zh7314 opened this issue May 14, 2024 · 3 comments
Labels

Comments

@zh7314
Copy link

zh7314 commented May 14, 2024

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

@theofidry
Copy link
Member

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:

  • a PHAR is a readonly environment, that means if you have any write operation like a cache warmup, it needs to be done before shipping the code into the PHAR.
  • as per above, if you do write temporary files, you need to adjust your application to write somewhere on the disk and not in the PHAR.
  • it won't work for a webserver (PHARs do fine with it, but it's an old way with a very big and complicated API, I just removed all support for it when worked on Box because it was something I was not familiar with and not worth doing).

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
Copy link
Author

zh7314 commented May 15, 2024

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

@yoramdelangen
Copy link

yoramdelangen commented May 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants