Skip to content

Commit d54c80f

Browse files
committed
Listeners (resetters) for the 3rd party packages are enabled by default
1 parent b00b1b6 commit d54c80f

File tree

7 files changed

+36
-9
lines changed

7 files changed

+36
-9
lines changed

CHANGELOG.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
66

7-
## UNRELEASED
7+
## v5.3.0
88

99
### Added
1010

11-
- Possibility to use different classes of workers for different worker modes
12-
- Integration with [Ziggy](https://github.com/tighten/ziggy) is supported now (just enable `ResetZiggyListener` for `BeforeLoopIterationEvent`)
11+
- Possibility to use different classes of workers for different worker modes [#65]
12+
- Integration with [Ziggy](https://github.com/tighten/ziggy) is supported now (just enable `ResetZiggyListener` for `BeforeLoopIterationEvent`) [#64]
13+
14+
### Changed
15+
16+
- Listeners (resetters) for the 3rd party packages are enabled by default
17+
18+
[#64]:https://github.com/spiral/roadrunner-laravel/issues/64
19+
[#65]:https://github.com/spiral/roadrunner-laravel/issues/65
1320

1421
## v5.2.2
1522

config/roadrunner.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,10 @@
3333
'listeners' => [
3434
Events\BeforeLoopStartedEvent::class => [
3535
...Defaults::beforeLoopStarted(),
36-
// Listeners\SetupTelescopeListener::class, // for <https://github.com/laravel/telescope>
3736
],
3837

3938
Events\BeforeLoopIterationEvent::class => [
4039
...Defaults::beforeLoopIteration(),
41-
// Listeners\ResetLaravelScoutListener::class, // for <https://github.com/laravel/scout>
42-
// Listeners\ResetLaravelSocialiteListener::class, // for <https://github.com/laravel/socialite>
43-
// Listeners\ResetInertiaListener::class, // for <https://github.com/inertiajs/inertia-laravel>
44-
// Listeners\ResetZiggyListener::class, // for <https://github.com/tighten/ziggy>
4540
],
4641

4742
Events\BeforeRequestHandlingEvent::class => [

src/Defaults.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public static function beforeLoopStarted(): array
1717
Listeners\FixSymfonyFileValidationListener::class,
1818
Listeners\FixSymfonyFileMovingListener::class,
1919
Listeners\WarmInstancesListener::class,
20+
21+
// 3rd party packages:
22+
Listeners\SetupTelescopeListener::class, // for <https://github.com/laravel/telescope>
2023
];
2124
}
2225

@@ -46,6 +49,12 @@ public static function beforeLoopIteration(): array
4649
Listeners\ResetSessionListener::class,
4750
Listeners\ResetProvidersListener::class,
4851
Listeners\ResetLocaleStateListener::class,
52+
53+
// 3rd party packages:
54+
Listeners\ResetLaravelScoutListener::class, // for <https://github.com/laravel/scout>
55+
Listeners\ResetLaravelSocialiteListener::class, // for <https://github.com/laravel/socialite>
56+
Listeners\ResetInertiaListener::class, // for <https://github.com/inertiajs/inertia-laravel>
57+
Listeners\ResetZiggyListener::class, // for <https://github.com/tighten/ziggy>
4958
];
5059
}
5160

src/Listeners/ResetInertiaListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ class ResetInertiaListener implements ListenerInterface
2121
*/
2222
public function handle($event): void
2323
{
24+
if (!\class_exists(InertiaResponseFactory::class)) {
25+
return;
26+
}
27+
2428
if ($event instanceof WithApplication) {
2529
$app = $event->application();
2630

src/Listeners/ResetLaravelScoutListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ class ResetLaravelScoutListener implements ListenerInterface
2121
*/
2222
public function handle($event): void
2323
{
24+
if (!\class_exists(ScoutEngineManager::class)) {
25+
return;
26+
}
27+
2428
if ($event instanceof WithApplication) {
2529
$app = $event->application();
2630

src/Listeners/ResetLaravelSocialiteListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ class ResetLaravelSocialiteListener implements ListenerInterface
2121
*/
2222
public function handle($event): void
2323
{
24+
if (!\class_exists(\Laravel\Socialite\SocialiteManager::class)) {
25+
return;
26+
}
27+
2428
if ($event instanceof WithApplication) {
2529
$app = $event->application();
2630

src/Listeners/SetupTelescopeListener.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ class SetupTelescopeListener implements ListenerInterface
1919
*/
2020
public function handle($event): void
2121
{
22+
if (!\class_exists(Telescope::class)) {
23+
return;
24+
}
25+
2226
if ($event instanceof WithApplication) {
2327
/** @var ConfigRepository $config */
2428
$config = $event->application()->make(ConfigRepository::class);
2529

26-
if (!\class_exists(Telescope::class) || !$config->get('telescope.enabled')) {
30+
if (!$config->get('telescope.enabled')) {
2731
return;
2832
}
2933

0 commit comments

Comments
 (0)