AfterPackageActivationEvent
New in version 10.3
The event was introduced to replace the Signal/Slot
\TYPO3\
.
The PSR-14 event \TYPO3\
is triggered after a package has been activated.
Attention
This event is dispatched when an extension is activated in the Extension Manager, therefore starting with TYPO3 v11 this event is only dispatched in legacy installations, not in Composer-based installations. Use installer events by Composer for Composer-based installations.
Example
Registration of the event listener in the extension's Services.
:
services:
# Place here the default dependency injection configuration
MyVendor\MyExtension\Package\EventListener\MyEventListener:
tags:
- name: event.listener
identifier: 'my-extension/extension-activated'
Read how to configure dependency injection in extensions.
An implementation of the event listener:
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Package\EventListener;
use TYPO3\CMS\Core\Package\Event\AfterPackageActivationEvent;
final class MyEventListener
{
public function __invoke(AfterPackageActivationEvent $event)
{
if ($event->getPackageKey() === 'my_extension') {
$this->executeInstall();
}
}
private function executeInstall(): void
{
// do something
}
}