ModifyLanguagePackRemoteBaseUrlEvent 

The PSR-14 event \TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent allows to modify the main URL of a language pack.

Example 

EXT:my_extension/Classes/EventListener/CustomMirror.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent;

#[AsEventListener(
  identifier: 'my-extension/custom-mirror',
)]
final readonly class CustomMirror
{
  private const EXTENSION_KEY = 'my_extension';
  private const MIRROR_URL = 'https://example.org/typo3-packages/';

  public function __invoke(ModifyLanguagePackRemoteBaseUrlEvent $event): void
  {
    if ($event->getPackageKey() === self::EXTENSION_KEY) {
      $event->setBaseUrl(new Uri(self::MIRROR_URL));
    }
  }
}
Copied!

New in version 13.0

The PHP attribute \TYPO3\CMS\Core\Attribute\AsEventListener has been introduced to tag a PHP class as an event listener. Alternatively, or if you need to be compatible with older TYPO3 versions, you can also register an event listener via the Configuration/Services.yaml file. Switch to an older version of this page for an example or have a look at the section Implementing an event listener in your extension.

API 

final class ModifyLanguagePackRemoteBaseUrlEvent
Fully qualified name
\TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent

Event to modify the main URL of a language

getBaseUrl()
Returns
\Psr\Http\Message\UriInterface
setBaseUrl(\Psr\Http\Message\UriInterface $baseUrl)
param $baseUrl

the baseUrl

getPackageKey()
Returns
string