I created a new Laravel 8 project, which comes with Laravel Sail, a pre-configured Docker environment. It works well, until I need to use a PHP extension.
The Laravel Sail documentation does not appear to mention anything about PHP extensions, which is a significant problem. Any non-trivial PHP site has to use several PHP extensions. Without the ability to add PHP extensions, Laravel Sail (or any other PHP environment) is more or less useless.
There's a Dockerfile
and a php.ini
in vendor/laravel/sail/runtimes/8.0/
. I could copy those files out of vendor
and into my own project's code, and hack the docker-compose.yml
to point to my versions of those files. However, if I do that, I'll lose any future fixes or improvements that the Laravel Sail people make to those files.
I'm aware of the sail artisan sail:publish
command that they mention at the end of the Laravel Sail documentation (https://laravel.com/docs/8.x/sail#sail-customization). It seems to just do what I mentioned above: copies the third-party code into my project, and now suddenly this end-user website is responsible for maintaining its own copy of Laravel Sail.
Surely there's an idiomatic way to add PHP extensions in Laravel Sail, without re-implementing a fork of Laravel Sail in my site's code?
vendor
directory. Thesail artisan sail:publish
solution that I'm using works, but it pollutes this website's code with third-party code that should be invendor
. – Podolsksail artisan sail:publish
is there just to give you the files, do with it whatever you want. If someone decides to keep them with application, its their choice, but its better to separate them as you pointed out. – Dreadfully