[1.x] Add configurable PHP and Composer paths#437
Conversation
|
I'm aware of #419 , however, I think this more aligns with the existing approach (config variables are used in other places), later (if necessary) can be extended for NPM and other commands, and allows developers to have their settings in the boost config file. |
pushpak1300
left a comment
There was a problem hiding this comment.
'commands' => [
'php' => 'php',
'composer' => 'composer',
], Do you think config name like this is more readable instead of default_php_bin ?
|
My reasoning for the
And they have higher precedence. These variables simply act as overrides or modifiers for the default bin paths. |
|
That said, I don't mind either way and I've made the necessary changes. It is probably a better config structure this way. |
|
Should some default config be added to https://github.com/laravel/boost/blob/1.x/config/boost.php to document this? Also, could the existing |
Adjusted the On the second point, I consider that out of scope. It could cause more confusion than help (?) and not everything is configurable through setup anyway. |
|
@fritz-c @pushpak1300 Thanks for the reviews! I think the PR now covers all binaries + vendor bin prefix. |
|
Thanks @aivis i will probably take a look today and try to merge. |
|
I think it would be nice if it detected a |
|
Please consider #429 and that having the project set up with Sail does not mean every command needs to run via Sail, especially when using devcontainers where commands are ran "natively" without any prefix. |
|
@aivis i will port this changes to main branch also. thanks for all the help. |
Summary
This PR adds support for configurable PHP and Composer binary paths through two new configuration options:
boost.default_php_bin- Configure the PHP binary path (defaults tophp)boost.default_composer_bin- Configure the Composer binary path (defaults tocomposer)Motivation
Many developers use containerized or specialized development environments like Lando, DDEV, Nix, Homebrew, or custom Docker setups where PHP and Composer binaries are not available at the standard
phpandcomposerpaths:lando(lando composeretc.)./usr/local/bin/php8.3)This feature allows developers to configure their environment and have Boost generate correct commands for their setup.
I did not add these config keys to the
config/boost.phpfile as it seems to be the case for other custom config keys.Changes
CodeEnvironment::getPhpPath()- Now reads fromconfig('boost.default_php_bin', 'php')when not forcing absolute pathsGuidelineAssist::composerCommand()- Now reads fromconfig('boost.default_composer_bin', 'composer')when not using SailGuidelineAssist::artisan()- Now uses the configured PHP binary for artisan commands when not using SailUsage
Add the following to your
config/boost.phpfile: