Skip to content

Commit f58b3f2

Browse files
authored
Merge branch 'main' into dont-overwrite-invalid-json
2 parents a3a7afe + f8f847a commit f58b3f2

File tree

8 files changed

+147
-43
lines changed

8 files changed

+147
-43
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
# Release Notes
22

3-
## [Unreleased](https://github.com/laravel/boost/compare/v1.0.17...main)
3+
## [Unreleased](https://github.com/laravel/boost/compare/v1.0.18...main)
4+
5+
## [v1.0.18](https://github.com/laravel/boost/compare/v1.0.17...v1.0.18) - 2025-08-16
6+
7+
### What's Changed
8+
9+
* fix: Prevent install command from breaking when `/tests` doesn't exist by [@sagalbot](https://github.com/sagalbot) in https://github.com/laravel/boost/pull/93
10+
* [1.x] Add enabled option to `config/boost.php`. by [@xiCO2k](https://github.com/xiCO2k) in https://github.com/laravel/boost/pull/143
11+
12+
### New Contributors
13+
14+
* [@sagalbot](https://github.com/sagalbot) made their first contribution in https://github.com/laravel/boost/pull/93
15+
* [@xiCO2k](https://github.com/xiCO2k) made their first contribution in https://github.com/laravel/boost/pull/143
16+
17+
**Full Changelog**: https://github.com/laravel/boost/compare/v1.0.17...v1.0.18
418

519
## [v1.0.17](https://github.com/laravel/boost/compare/v1.0.16...v1.0.17) - 2025-08-14
620

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Laravel Boost includes AI guidelines for the following packages and frameworks.
7373
| Pest | core, 4.x |
7474
| PHPUnit | core |
7575
| Pint | core |
76-
| TailwindCSS | core, 3.x, 4.x |
76+
| Tailwind CSS | core, 3.x, 4.x |
7777
| Livewire Volt | core |
7878
| Laravel Folio | core |
7979
| Enforce Tests | conditional |

all.php

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,15 @@
88
use Laravel\Boost\Install\GuidelineConfig;
99
use Laravel\Boost\Install\Herd;
1010
use Laravel\Roster\Roster;
11-
use Orchestra\Testbench\Concerns\CreatesApplication;
12-
13-
// Create a simple class that uses Orchestra Testbench to bootstrap Laravel
14-
$testbench = new class
15-
{
16-
use CreatesApplication;
17-
18-
protected function getPackageProviders($app)
19-
{
20-
// No need to register Laravel Boost since we're just using Blade
21-
return [];
22-
}
23-
24-
protected function defineEnvironment($app)
25-
{
26-
// Set a .test URL to enable Herd guidelines if needed
27-
$app['config']->set('app.url', 'http://localhost.test');
28-
}
29-
30-
public function bootstrap()
31-
{
32-
$app = $this->createApplication();
33-
34-
return $app;
35-
}
36-
};
37-
38-
// Bootstrap the Laravel application
39-
$app = $testbench->bootstrap();
11+
use Orchestra\Testbench\Foundation\Application as Testbench;
12+
use Orchestra\Testbench\Foundation\Config as TestbenchConfig;
13+
14+
// Bootstrap the Laravel application using Testbench
15+
$app = Testbench::createFromConfig(new TestbenchConfig([
16+
'env' => [
17+
'APP_URL=http://localhost.test',
18+
],
19+
]), options: ['enables_package_discoveries' => false]);
4020

4121
// Create a mock Roster that returns ALL packages from .ai/ directory
4222
$mockRoster = new class extends Roster

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
"source": "https://github.com/laravel/boost"
1414
},
1515
"require": {
16-
"php": "^8.1|^8.2",
16+
"php": "^8.1",
1717
"guzzlehttp/guzzle": "^7.9",
1818
"illuminate/console": "^10.0|^11.0|^12.0",
1919
"illuminate/contracts": "^10.0|^11.0|^12.0",
2020
"illuminate/routing": "^10.0|^11.0|^12.0",
2121
"illuminate/support": "^10.0|^11.0|^12.0",
22-
"laravel/mcp": "^0.1.0",
22+
"laravel/mcp": "^0.1.1",
2323
"laravel/prompts": "^0.1.9|^0.3",
2424
"laravel/roster": "^0.2"
2525
},
2626
"require-dev": {
27-
"laravel/pint": "^1.14|^1.23",
27+
"laravel/pint": "^1.14",
2828
"mockery/mockery": "^1.6",
2929
"orchestra/testbench": "^8.22.0|^9.0|^10.0",
3030
"pestphp/pest": "^2.0|^3.0",

config/boost.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44

55
return [
66

7+
/*
8+
|--------------------------------------------------------------------------
9+
| Boost Master Switch
10+
|--------------------------------------------------------------------------
11+
|
12+
| This option may be used to disable all Boost functionality - which
13+
| will prevent Boost's routes from being registered and will also
14+
| disable Boost's browser logging functionality from operating.
15+
|
16+
*/
17+
18+
'enabled' => env('BOOST_ENABLED', true),
19+
720
/*
821
|--------------------------------------------------------------------------
922
| Boost Browser Logs Watcher

src/BoostServiceProvider.php

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public function register(): void
2626
'boost'
2727
);
2828

29+
if (! $this->shouldRun()) {
30+
return;
31+
}
32+
2933
$this->app->singleton(Roster::class, function () {
3034
$lockFiles = [
3135
base_path('composer.lock'),
@@ -55,20 +59,21 @@ public function register(): void
5559

5660
public function boot(Router $router): void
5761
{
58-
// Only enable Boost on local environments
59-
if (! app()->environment(['local', 'testing']) && config('app.debug', false) !== true) {
62+
if (! $this->shouldRun()) {
6063
return;
6164
}
6265

63-
// @phpstan-ignore-next-line
6466
Mcp::local('laravel-boost', Boost::class);
6567

6668
$this->registerPublishing();
6769
$this->registerCommands();
6870
$this->registerRoutes();
69-
$this->registerBrowserLogger();
70-
$this->callAfterResolving('blade.compiler', fn (BladeCompiler $bladeCompiler) => $this->registerBladeDirectives($bladeCompiler));
71-
$this->hookIntoResponses($router);
71+
72+
if (config('boost.browser_logs_watcher', true)) {
73+
$this->registerBrowserLogger();
74+
$this->callAfterResolving('blade.compiler', fn (BladeCompiler $bladeCompiler) => $this->registerBladeDirectives($bladeCompiler));
75+
$this->hookIntoResponses($router);
76+
}
7277
}
7378

7479
private function registerPublishing(): void
@@ -175,10 +180,24 @@ private static function mapJsTypeToPsr3Level(string $type): string
175180

176181
private function hookIntoResponses(Router $router): void
177182
{
178-
if (! config('boost.browser_logs_watcher', true)) {
179-
return;
183+
$router->pushMiddlewareToGroup('web', InjectBoost::class);
184+
}
185+
186+
private function shouldRun(): bool
187+
{
188+
if (! config('boost.enabled', true)) {
189+
return false;
180190
}
181191

182-
$router->pushMiddlewareToGroup('web', InjectBoost::class);
192+
if (app()->runningUnitTests()) {
193+
return false;
194+
}
195+
196+
// Only enable Boost on local environments or when debug is true
197+
if (! app()->environment('local') && config('app.debug', false) !== true) {
198+
return false;
199+
}
200+
201+
return true;
183202
}
184203
}

src/Console/ExecuteToolCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class ExecuteToolCommand extends Command
1414

1515
protected $description = 'Execute a Boost MCP tool in isolation (internal command)';
1616

17+
protected $hidden = true;
18+
1719
public function handle(): int
1820
{
1921
$toolClass = $this->argument('tool');
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Illuminate\Support\Facades\Config;
6+
use Laravel\Boost\BoostServiceProvider;
7+
8+
beforeEach(function () {
9+
$this->refreshApplication();
10+
Config::set('logging.channels.browser', null);
11+
});
12+
13+
describe('boost.enabled configuration', function () {
14+
it('does not boot boost when disabled', function () {
15+
Config::set('boost.enabled', false);
16+
app()->detectEnvironment(fn () => 'local');
17+
18+
$provider = new BoostServiceProvider(app());
19+
$provider->register();
20+
$provider->boot(app('router'));
21+
22+
$this->artisan('list')->expectsOutputToContain('boost:install');
23+
});
24+
25+
it('boots boost when enabled in local environment', function () {
26+
Config::set('boost.enabled', true);
27+
app()->detectEnvironment(fn () => 'local');
28+
29+
$provider = new BoostServiceProvider(app());
30+
$provider->register();
31+
$provider->boot(app('router'));
32+
33+
expect(app()->bound(Laravel\Roster\Roster::class))->toBeTrue();
34+
expect(config('logging.channels.browser'))->not->toBeNull();
35+
});
36+
});
37+
38+
describe('environment restrictions', function () {
39+
it('does not boot boost in production even when enabled', function () {
40+
Config::set('boost.enabled', true);
41+
Config::set('app.debug', false);
42+
app()->detectEnvironment(fn () => 'production');
43+
44+
$provider = new BoostServiceProvider(app());
45+
$provider->register();
46+
$provider->boot(app('router'));
47+
48+
expect(config('logging.channels.browser'))->toBeNull();
49+
});
50+
51+
describe('testing environment', function () {
52+
it('does not boot boost when debug is false', function () {
53+
Config::set('boost.enabled', true);
54+
Config::set('app.debug', false);
55+
app()->detectEnvironment(fn () => 'testing');
56+
57+
$provider = new BoostServiceProvider(app());
58+
$provider->register();
59+
$provider->boot(app('router'));
60+
61+
expect(config('logging.channels.browser'))->toBeNull();
62+
});
63+
64+
it('does not boot boost when debug is true', function () {
65+
Config::set('boost.enabled', true);
66+
Config::set('app.debug', true);
67+
app()->detectEnvironment(fn () => 'testing');
68+
69+
$provider = new BoostServiceProvider(app());
70+
$provider->register();
71+
$provider->boot(app('router'));
72+
73+
expect(config('logging.channels.browser'))->toBeNull();
74+
});
75+
});
76+
});

0 commit comments

Comments
 (0)