Check Compatibility: Verify your project meets the new requirements:
composer show symfony/* and php -v to confirm.Installation:
composer require answear/wide-eyes-bundle:^3.0
Add the bundle to config/bundles.php:
return [
// ...
WideEyes\Bundle\WideEyesBundle::class => ['all' => true],
];
First Use Case:
WideEyes\Event\EyeEvent in a controller:
use WideEyes\Event\EyeEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
public function __construct(private EventDispatcherInterface $dispatcher) {}
public function someAction() {
$this->dispatcher->dispatch(new EyeEvent());
}
Event-Driven Workflows:
Subscribe to WideEyes\Event\* events in Symfony’s services.yaml:
services:
App\Listener\MyListener:
tags:
- { name: 'kernel.event_listener', event: WideEyes\Event\EyeEvent, method: onEyeEvent }
Dependency Injection:
Autowire services from the bundle (e.g., WideEyes\Service\EyeService) in Laravel controllers or Symfony commands.
Service Providers:
Register Symfony services as Laravel bindings in AppServiceProvider:
public function register() {
$this->app->singleton(
WideEyes\Service\EyeService::class,
fn($app) => $app->make('wide_eyes.eye_service')
);
}
Console Commands: Use Symfony’s container-aware commands:
use Symfony\Component\Console\Command\Command;
use WideEyes\Service\EyeService;
class MyCommand extends Command {
public function __construct(private EyeService $eyeService) {}
// ...
}
Symfony/PHP Version Drop:
symfony/ux or similar alternatives.2.x branch (if still available).composer why-not for dependency conflicts.Namespace/Class Changes:
use statements (e.g., WideEyes\Bundle\* → WideEyes\*).php artisan optimize:clear after updates.Event Dispatching:
Enable Symfony’s debug toolbar (APP_DEBUG=true) to inspect dispatched events.
$this->dispatcher->addListener(EyeEvent::class, fn($event) => error_log('Event triggered!'));
Configuration:
Override bundle defaults via config/packages/wide_eyes.yaml:
wide_eyes:
enabled: true
debug: '%kernel.debug%'
Custom Events:
Extend WideEyes\Event\EyeEvent for project-specific logic:
class CustomEyeEvent extends EyeEvent {
public function __construct(private string $customData) {}
public function getCustomData(): string { return $this->customData; }
}
Service Decorators:
Decorate EyeService to modify behavior:
services:
wide_eyes.eye_service.decorated:
decorates: wide_eyes.eye_service
arguments: ['@wide_eyes.eye_service.decorated.inner']
How can I help you explore Laravel packages today?