Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix PHPStorm using absolute paths #109

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

Merged
ashleyhindle merged 13 commits into main from fix-phpstorm-on-windows-v1
Aug 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
5f0a446
Fix PHPStorm on Windows v1
ashleyhindle Aug 14, 2025
aaf038d
feat: use absolute path for phpstorm with test
ashleyhindle Aug 14, 2025
e172266
refactor: streamline path resolution and simplify the MCP client inte...
pushpak1300 Aug 14, 2025
2bc02f8
Fix code styling
pushpak1300 Aug 14, 2025
6e29dbf
refactor: simplify artisan path resolution by removing fallback
pushpak1300 Aug 14, 2025
a517e34
Fix code styling
pushpak1300 Aug 14, 2025
01204b8
refactor: simplify artisan path resolution logic
pushpak1300 Aug 14, 2025
cbba494
refactor: update artisan path resolution to use current working direc...
pushpak1300 Aug 14, 2025
44b2001
Merge pull request #111 from laravel/refactor/#109
ashleyhindle Aug 14, 2025
e0a03cc
reuse $php for herd install
ashleyhindle Aug 14, 2025
605e2af
Merge branch 'main' into fix-phpstorm-on-windows-v1
pushpak1300 Aug 14, 2025
51ce47b
refactor: use `base_path` for artisan path resolution
pushpak1300 Aug 14, 2025
e9c56dc
Merge branch 'main' into fix-phpstorm-on-windows-v1
ashleyhindle Aug 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Console/InstallCommand.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,18 @@ private function installMcpServerConfig(): void
)->toArray()
);

/** @var CodeEnvironment $mcpClient */
/** @var McpClient $mcpClient */
foreach ($this->selectedTargetMcpClient as $mcpClient) {
$ideName = $mcpClient->mcpClientName();
$ideDisplay = str_pad($ideName, $longestIdeName);
$this->output->write(" {$ideDisplay}... ");
$results = [];

$php = $mcpClient->getPhpPath();
if ($this->shouldInstallMcp()) {
try {
$artisan = $mcpClient->useAbsolutePathForMcp ? base_path('artisan') : './artisan';
$result = $mcpClient->installMcp('laravel-boost', 'php', [$artisan, 'boost:mcp']);
$artisan = $mcpClient->getArtisanPath();
$result = $mcpClient->installMcp('laravel-boost', $php, [$artisan, 'boost:mcp']);

if ($result) {
$results[] = $this->greenTick.' Boost';
Expand All @@ -491,7 +492,7 @@ private function installMcpServerConfig(): void
try {
$result = $mcpClient->installMcp(
key: 'herd',
command: 'php',
command: $php,
args: [$this->herd->mcpPath()],
env: ['SITE_PATH' => base_path()]
);
Expand Down
15 changes: 15 additions & 0 deletions src/Contracts/McpClient.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ interface McpClient
*/
public function mcpClientName(): ?string;

/**
* Whether to use absolute paths for MCP commands.
*/
public function useAbsolutePathForMcp(): bool;

/**
* Get the PHP executable path for this MCP client.
*/
public function getPhpPath(): string;

/**
* Get the artisan path for this MCP client.
*/
public function getArtisanPath(): string;

/**
* Install an MCP server configuration in this IDE.
*
Expand Down
16 changes: 16 additions & 0 deletions src/Install/CodeEnvironment/CodeEnvironment.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ public function mcpClientName(): ?string
return $this->displayName();
}

public function useAbsolutePathForMcp(): bool
{
return $this->useAbsolutePathForMcp;
}

public function getPhpPath(): string
{
return $this->useAbsolutePathForMcp() ? PHP_BINARY : 'php';
}

public function getArtisanPath(): string
{
return $this->useAbsolutePathForMcp() ? base_path('artisan') : './artisan';

}

/**
* Get the detection configuration for system-wide installation detection.
*
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

use Laravel\Boost\Install\CodeEnvironment\Cursor;
use Laravel\Boost\Install\CodeEnvironment\PhpStorm;
use Laravel\Boost\Install\Detection\DetectionStrategyFactory;

test('PhpStorm returns absolute PHP_BINARY path', function () {
$strategyFactory = Mockery::mock(DetectionStrategyFactory::class);
$phpStorm = new PhpStorm($strategyFactory);

expect($phpStorm->getPhpPath())->toBe(PHP_BINARY);
});

test('PhpStorm returns absolute artisan path', function () {
$strategyFactory = Mockery::mock(DetectionStrategyFactory::class);
$phpStorm = new PhpStorm($strategyFactory);

$artisanPath = $phpStorm->getArtisanPath();

// Should be an absolute path ending with 'artisan'
expect($artisanPath)->toEndWith('artisan')
->and($artisanPath)->not()->toBe('./artisan');
});

test('Cursor returns relative php string', function () {
$strategyFactory = Mockery::mock(DetectionStrategyFactory::class);
$cursor = new Cursor($strategyFactory);

expect($cursor->getPhpPath())->toBe('php');
});

test('Cursor returns relative artisan path', function () {
$strategyFactory = Mockery::mock(DetectionStrategyFactory::class);
$cursor = new Cursor($strategyFactory);

expect($cursor->getArtisanPath())->toBe('./artisan');
});

AltStyle によって変換されたページ (->オリジナル) /