Skip to content

Commit fc1ff9f

Browse files
committed
[5.x] Utilise Illuminate\Support\php_binary()
This would improves installation on Laravel Herd Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
1 parent 80543f7 commit fc1ff9f

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
composer config repositories.jetstream '{"type": "path", "url": "jetstream"}' --file composer.json
7171
7272
- name: Checkout code
73-
uses: actions/checkout@v3
73+
uses: actions/checkout@v4
7474
with:
7575
path: 'jetstream'
7676

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"require": {
1717
"php": "^8.2.0",
1818
"ext-json": "*",
19-
"illuminate/console": "^11.0",
20-
"illuminate/support": "^11.0",
19+
"illuminate/console": "^11.25",
20+
"illuminate/support": "^11.25",
2121
"laravel/fortify": "^1.20",
2222
"mobiledetect/mobiledetectlib": "^4.8",
2323
"symfony/console": "^7.0"

src/Console/InstallCommand.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
use Symfony\Component\Console\Input\InputInterface;
1515
use Symfony\Component\Console\Output\OutputInterface;
1616
use Symfony\Component\Finder\Finder;
17-
use Symfony\Component\Process\PhpExecutableFinder;
1817
use Symfony\Component\Process\Process;
1918

19+
use function Illuminate\Support\php_binary;
2020
use function Laravel\Prompts\confirm;
2121
use function Laravel\Prompts\multiselect;
2222
use function Laravel\Prompts\select;
@@ -397,7 +397,7 @@ protected function installInertiaStack()
397397

398398
// Middleware...
399399
(new Filesystem)->ensureDirectoryExists(app_path('Http/Middleware'));
400-
(new Process([$this->phpBinary(), 'artisan', 'inertia:middleware', 'HandleInertiaRequests', '--force'], base_path()))
400+
(new Process([php_binary(), 'artisan', 'inertia:middleware', 'HandleInertiaRequests', '--force'], base_path()))
401401
->setTimeout(null)
402402
->run(function ($type, $output) {
403403
$this->output->write($output);
@@ -656,7 +656,7 @@ protected function requireComposerPackages($packages)
656656
$composer = $this->option('composer');
657657

658658
if ($composer !== 'global') {
659-
$command = [$this->phpBinary(), $composer, 'require'];
659+
$command = [php_binary(), $composer, 'require'];
660660
}
661661

662662
$command = array_merge(
@@ -682,7 +682,7 @@ protected function removeComposerDevPackages($packages)
682682
$composer = $this->option('composer');
683683

684684
if ($composer !== 'global') {
685-
$command = [$this->phpBinary(), $composer, 'remove', '--dev'];
685+
$command = [php_binary(), $composer, 'remove', '--dev'];
686686
}
687687

688688
$command = array_merge(
@@ -708,7 +708,7 @@ protected function requireComposerDevPackages($packages)
708708
$composer = $this->option('composer');
709709

710710
if ($composer !== 'global') {
711-
$command = [$this->phpBinary(), $composer, 'require', '--dev'];
711+
$command = [php_binary(), $composer, 'require', '--dev'];
712712
}
713713

714714
$command = array_merge(
@@ -761,7 +761,7 @@ protected static function updateNodePackages(callable $callback, $dev = true)
761761
protected function runDatabaseMigrations()
762762
{
763763
if (confirm('New database migrations were added. Would you like to re-run your migrations?', true)) {
764-
(new Process([$this->phpBinary(), 'artisan', 'migrate:fresh', '--force'], base_path()))
764+
(new Process([php_binary(), 'artisan', 'migrate:fresh', '--force'], base_path()))
765765
->setTimeout(null)
766766
->run(function ($type, $output) {
767767
$this->output->write($output);
@@ -795,16 +795,6 @@ protected function removeDarkClasses(Finder $finder)
795795
}
796796
}
797797

798-
/**
799-
* Get the path to the appropriate PHP binary.
800-
*
801-
* @return string
802-
*/
803-
protected function phpBinary()
804-
{
805-
return (new PhpExecutableFinder())->find(false) ?: 'php';
806-
}
807-
808798
/**
809799
* Run the given commands.
810800
*

0 commit comments

Comments
 (0)