Search code examples
phplaravelevent-listener

Laravel - Why EventServiceProvider extends itself?


My EventServisProvider is

use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;

class EventServiceProvider extends ServiceProvider
{

I am using Laravel 7 and I noticed that:

class EventServiceProvider extends ServiceProvider

as default. And

use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

which means EventServiceProvider extends itself.

What is the logic here. Any ideas? Thanks in advance.

Please explain it as I am 5.


Solution

  • its extend another event provider because Illuminate\Foundation\Support\Providers\EventServiceProvider is an abstraction on how to handle event in laravel application, extending it allow user to modify or override default implementation. but at the end of the day, Illuminate\Foundation\Support\Providers\EventServiceProvider still extend Illuminate\Support\ServiceProvider