One option would be to install php 7 and switch between 7 and 8 as needed. There may be a more elegant approach, but this is certainly viable and pretty easy for accommodating local development in different Laravel versions. This is what I do and it's pretty seamless.
Use sail without PHP on the machine
My idea is to use sail (for docker) on Mac M2 (year 2023) which comes with PHP8.X. My old projects are in version 7.x while new client projects are in Laravel 9 (which used php 8.x). From reading the blogs around, the best recommendation is to use docker. So I started looking for Sail/Docker settings for Laravel 7 and finally found this -https://github.com/ajuCubettech/sail-7.x but the issue is to run composer require ajuchacko/sail-7.x --dev I need php7.x which my local has only php 8.x and so am back to square 1.
I assume the best option would be to write the docker configuration for this so all my dependencies are pulled and installed within the docker, but since writing docker config is tough for me at this moment (am just starting with docker, pretty fresh) I'm planning to go with the above link.
How do you guys handle the environment dependencies? I use the following services-
- Laravel
- MySQL
- phpmyadmin
Please or to participate in this conversation.