---
title: "Using and dispatching events in extensions"
manual: "TYPO3 Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3coreapi:extension-development-events@main"
source: "ExtensionArchitecture/HowTo/Events/Index.rst"
rendered: "2026-09-19T06:56:03+00:00"
---

# Using and dispatching events in extensions {#extension-development-events}

[PSR-14 events](https://docs.typo3.org/permalink/t3coreapi:eventdispatcher@main) can be used to extend the TYPO3 Core
or third-party extensions.

You can find a complete list of events provided by the TYPO3 Core in the
following chapter: [Event list](https://docs.typo3.org/permalink/t3coreapi:eventlist@main).

Events provided by third-party extensions should be described in the extension's
manual. You can also search for events by looking for classes that inject the
[Psr\\EventDispatcher\\EventDispatcherInterface](https://docs.typo3.org/permalink/t3coreapi:eventdispatcherobject@main).

## Listen to an event {#extension-development-event-listener}

If you want to use an event provided by the Core or a third-party extension,
create a PHP class with a method `__invoke(SomeCoolEvent $event)`
that accepts an object of the event class as
argument. It is possible to use another method name but you have to configure
the name in the [`Configuration/Services.yaml`](../../FileStructure/Configuration/ServicesYaml.md#file-extension-configuration-services-yaml) or it is not found.

It is best practice to use a descriptive class name and to put it in the
namespace `\MyVendor\MyExtension\EventListener`.

**EXT:my_extension/Classes/EventListener/Joh316PasswordInformer.php**

```php
<?php

// EXT:my_extension/Classes/EventListener/Joh316PasswordInformer.php
declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use Psr\Log\LoggerInterface;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\FrontendLogin\Event\PasswordChangeEvent;

/**
 * The password 'joh316' was historically used as the default password for
 * the TYPO3 install tool.
 * Today this password is an unsecure choice as it is well-known, too short
 * and does not contain capital letters or special characters.
 */
#[AsEventListener]
final class Joh316PasswordInvalidator
{
  public function __construct(
    private readonly LoggerInterface $logger,
  ) {}

  public function __invoke(PasswordChangeEvent $event): void
  {
    if ($event->getRawPassword() === 'joh316') {
      $this->logger->warning(sprintf(
        'User %s uses the default password "joh316".',
        $event->getUser()['username'],
      ));
    }
  }
}

```

## Dispatch an event {#extension-development-events-dispatch-event}

You can dispatch events in your own extension's code to enable other extensions
to extend your code. Events are the preferred method of making code in TYPO3
extensions extendable.

See [Event Dispatcher, Quickstart](https://docs.typo3.org/permalink/t3coreapi:eventdispatcherquickstart@main) on how
to create a custom event and dispatch it.
