# Events & Listeners (Laravel) > Event creation, listener registration, dispatching events, event subscribers, queued listeners, broadcast events - 18 interview questions - Mid-Level - [Interview Questions: Laravel](https://sharpskill.dev/en/technologies/laravel/interview-questions.md) ## 1. What is an Event in Laravel? **Answer** An Event is a class that represents a significant action or occurrence that happened in the application. It serves as a data-carrying message that can be dispatched and listened to by multiple listeners in a decoupled manner. Events allow respecting the Open/Closed principle by adding behaviors without modifying existing code. ## 2. How to create an Event and its associated Listener with Artisan? **Answer** The command 'php artisan make:event' creates an Event, and 'php artisan make:listener' creates a Listener. By adding the --event=EventName option, the Listener is automatically typed to receive this Event. It's also possible to define the mapping in EventServiceProvider then run 'php artisan event:generate' to automatically generate all missing Events and Listeners. ## 3. Where to register the mapping between Events and Listeners in Laravel? **Answer** The Events-Listeners mapping is done in the $listen property of EventServiceProvider (App\Providers\EventServiceProvider). Each key is the fully qualified Event class name, and the value is an array of Listeners. Since Laravel 11, it's also possible to use auto-discovery with PHP 8 attributes #[ListensTo] to avoid manual registration. ## 15 more questions available - How to dispatch (trigger) an Event in Laravel? - What is the basic structure of a Listener in Laravel? Sign up for free: https://sharpskill.dev/en/login ## Other Laravel interview topics - [PHP Basics](https://sharpskill.dev/en/technologies/laravel/interview-questions/php-basics.md): 25 questions, Junior - [PHP OOP Essentials](https://sharpskill.dev/en/technologies/laravel/interview-questions/php-oop-essentials.md): 20 questions, Junior - [Composer & Autoloading](https://sharpskill.dev/en/technologies/laravel/interview-questions/composer-autoloading.md): 18 questions, Junior - [Laravel Fundamentals](https://sharpskill.dev/en/technologies/laravel/interview-questions/laravel-fundamentals.md): 20 questions, Junior - [Laravel Routing](https://sharpskill.dev/en/technologies/laravel/interview-questions/laravel-routing.md): 20 questions, Junior - [Blade Templates](https://sharpskill.dev/en/technologies/laravel/interview-questions/blade-templates.md): 18 questions, Junior - [Request & Response](https://sharpskill.dev/en/technologies/laravel/interview-questions/request-response.md): 20 questions, Junior - [Eloquent ORM Basics](https://sharpskill.dev/en/technologies/laravel/interview-questions/eloquent-orm-basics.md): 22 questions, Junior - [Eloquent Relationships](https://sharpskill.dev/en/technologies/laravel/interview-questions/eloquent-relationships.md): 25 questions, Mid-Level - [Migrations & Schema Builder](https://sharpskill.dev/en/technologies/laravel/interview-questions/database-migrations.md): 20 questions, Mid-Level - [Validation & Forms](https://sharpskill.dev/en/technologies/laravel/interview-questions/validation-forms.md): 22 questions, Mid-Level - [Authentication](https://sharpskill.dev/en/technologies/laravel/interview-questions/authentication.md): 20 questions, Mid-Level - [Authorization & Policies](https://sharpskill.dev/en/technologies/laravel/interview-questions/authorization-policies.md): 18 questions, Mid-Level - [API Resources & Authentication](https://sharpskill.dev/en/technologies/laravel/interview-questions/api-resources-authentication.md): 26 questions, Mid-Level - [Middleware](https://sharpskill.dev/en/technologies/laravel/interview-questions/middleware.md): 18 questions, Mid-Level - [Service Container & DI](https://sharpskill.dev/en/technologies/laravel/interview-questions/service-container-di.md): 20 questions, Mid-Level - [Queues & Jobs](https://sharpskill.dev/en/technologies/laravel/interview-questions/queues-jobs.md): 22 questions, Mid-Level - [Notifications & Mail](https://sharpskill.dev/en/technologies/laravel/interview-questions/notifications-mail.md): 20 questions, Mid-Level - [File Storage](https://sharpskill.dev/en/technologies/laravel/interview-questions/file-storage.md): 18 questions, Mid-Level - [Testing & PHPUnit](https://sharpskill.dev/en/technologies/laravel/interview-questions/testing-phpunit.md): 24 questions, Mid-Level - [Caching](https://sharpskill.dev/en/technologies/laravel/interview-questions/caching.md): 18 questions, Mid-Level - [Livewire & Inertia](https://sharpskill.dev/en/technologies/laravel/interview-questions/livewire-inertia.md): 20 questions, Mid-Level - [Eloquent Advanced](https://sharpskill.dev/en/technologies/laravel/interview-questions/eloquent-advanced.md): 24 questions, Senior - [Repository Pattern](https://sharpskill.dev/en/technologies/laravel/interview-questions/repository-pattern.md): 20 questions, Senior - [Laravel Packages](https://sharpskill.dev/en/technologies/laravel/interview-questions/laravel-packages.md): 20 questions, Senior - [Performance Optimization](https://sharpskill.dev/en/technologies/laravel/interview-questions/performance-optimization.md): 22 questions, Senior - [Security Best Practices](https://sharpskill.dev/en/technologies/laravel/interview-questions/security-best-practices.md): 22 questions, Senior - [Laravel Octane](https://sharpskill.dev/en/technologies/laravel/interview-questions/laravel-octane.md): 18 questions, Senior - [Laravel Distributed Systems](https://sharpskill.dev/en/technologies/laravel/interview-questions/laravel-distributed-systems.md): 22 questions, Senior - [Observability & Monitoring](https://sharpskill.dev/en/technologies/laravel/interview-questions/observability-monitoring.md): 20 questions, Senior - [Deployment & DevOps](https://sharpskill.dev/en/technologies/laravel/interview-questions/deployment-devops.md): 20 questions, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/en/technologies/laravel/interview-questions/events-listeners