-
Notifications
You must be signed in to change notification settings - Fork 233
[1.x] Add configurable PHP and Composer paths #437
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
base: 1.x
Are you sure you want to change the base?
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'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. |
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: