diff --git a/src/Hook/VirtualBaseHooks.php b/src/Hook/VirtualBaseHooks.php
new file mode 100644
index 0000000..05b08cc
--- /dev/null
+++ b/src/Hook/VirtualBaseHooks.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Drupal\virtual_base\Hook;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+/**
+ * Hook implementations for virtual_base.
+ */
+class VirtualBaseHooks
+{
+    /**
+     * Implements hook_form_alter().
+     */
+    #[Hook('form_alter', module: 'virtual_base_form_node')]
+    public function formNodeFormAlter(&$form, &$form_state)
+    {
+        $config = \Drupal::config('virtual_base.settings');
+        // Add clabback validate to virtual path prefix.
+        if (\Drupal::service('module_handler')->moduleExists('path_alias') && !empty($config) && $config->get('enabled') === TRUE) {
+            $form['#validate'][] = 'virtual_base_node_validate_alias';
+        }
+    }
+}
diff --git a/src/PathProcessor/VirtualBasePathProcessor.php b/src/PathProcessor/VirtualBasePathProcessor.php
index 919a086..6c80afd 100644
--- a/src/PathProcessor/VirtualBasePathProcessor.php
+++ b/src/PathProcessor/VirtualBasePathProcessor.php
@@ -54,7 +54,7 @@ class VirtualBasePathProcessor extends PathProcessorFront implements OutboundPat
    * @param \Drupal\path_alias\AliasManagerInterface|null $path_alias
    *   Path alias manager.
    */
-  public function __construct(ConfigFactoryInterface $config, VirtualBaseManagerInterface $helper, ModuleHandlerInterface $module_handler, AliasManagerInterface $path_alias = NULL) {
+  public function __construct(ConfigFactoryInterface $config, VirtualBaseManagerInterface $helper, ModuleHandlerInterface $module_handler, ?AliasManagerInterface $path_alias = NULL) {
     parent::__construct($config);
     $this->helper = $helper;
     $this->moduleHandler = $module_handler;
@@ -101,7 +101,7 @@ class VirtualBasePathProcessor extends PathProcessorFront implements OutboundPat
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     // Return the path with the virtual base prefix if found inside request.
     return $this->helper->resolveOutboundPath($path, $bubbleable_metadata);
   }
diff --git a/src/VirtualBaseManager.php b/src/VirtualBaseManager.php
index b2919fa..c33c013 100644
--- a/src/VirtualBaseManager.php
+++ b/src/VirtualBaseManager.php
@@ -89,7 +89,7 @@ class VirtualBaseManager implements VirtualBaseManagerInterface {
   /**
    * {@inheritDoc}
    */
-  public function resolveOutboundPath($path, CacheableMetadata $bubbleableMetadata = NULL): string {
+  public function resolveOutboundPath($path, ?CacheableMetadata $bubbleableMetadata = NULL): string {
     $prefix = $this->getPathPrefix();
     if ($bubbleableMetadata) {
       $bubbleableMetadata->addCacheContexts(['virtual_base']);
diff --git a/src/VirtualBaseManagerInterface.php b/src/VirtualBaseManagerInterface.php
index fe1bb79..848b650 100644
--- a/src/VirtualBaseManagerInterface.php
+++ b/src/VirtualBaseManagerInterface.php
@@ -49,7 +49,7 @@ interface VirtualBaseManagerInterface {
    * @return string
    *   The processed path.
    */
-  public function resolveOutboundPath($path, CacheableMetadata $bubbleableMetadata = NULL) : string;
+  public function resolveOutboundPath($path, ?CacheableMetadata $bubbleableMetadata = NULL) : string;
 
   /**
    * Alter HTML content to add the path prefix.
diff --git a/tests/src/Functional/VirtualBaseFormTest.php b/tests/src/Functional/VirtualBaseFormTest.php
index 4f3a3c9..5a41837 100644
--- a/tests/src/Functional/VirtualBaseFormTest.php
+++ b/tests/src/Functional/VirtualBaseFormTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\virtual_base\Functional;
 
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
 use Drupal\Core\Url;
 use Drupal\Tests\BrowserTestBase;
 use Drupal\Tests\Traits\Core\PathAliasTestTrait;
@@ -9,6 +10,7 @@ use Drupal\Tests\Traits\Core\PathAliasTestTrait;
 /**
  * Provides a base class for testing the Path module.
  */
+#[RunTestsInSeparateProcesses]
 class VirtualBaseFormTest extends BrowserTestBase {
 
   use PathAliasTestTrait;
diff --git a/tests/src/Functional/VirtualBaseMediaTest.php b/tests/src/Functional/VirtualBaseMediaTest.php
index a2518c3..2ae35de 100644
--- a/tests/src/Functional/VirtualBaseMediaTest.php
+++ b/tests/src/Functional/VirtualBaseMediaTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\virtual_base\Functional;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\file\Entity\File;
@@ -16,6 +18,8 @@ use Drupal\Tests\TestFileCreationTrait;
  *
  * @group media
  */
+#[Group('media')]
+#[RunTestsInSeparateProcesses]
 class VirtualBaseMediaTest extends VirtualBaseTestBase {
 
   use TestFileCreationTrait;
diff --git a/tests/src/Functional/VirtualBaseNodeAliasTest.php b/tests/src/Functional/VirtualBaseNodeAliasTest.php
index 07b762e..808b5b6 100644
--- a/tests/src/Functional/VirtualBaseNodeAliasTest.php
+++ b/tests/src/Functional/VirtualBaseNodeAliasTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\virtual_base\Functional;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
 use Drupal\Tests\Traits\Core\PathAliasTestTrait;
 
 /**
@@ -9,6 +11,8 @@ use Drupal\Tests\Traits\Core\PathAliasTestTrait;
  *
  * @group virtual_base
  */
+#[Group('virtual_base')]
+#[RunTestsInSeparateProcesses]
 class VirtualBaseNodeAliasTest extends VirtualBaseTestBase {
 
   use PathAliasTestTrait;
diff --git a/tests/src/Functional/VirtualBaseNodeTest.php b/tests/src/Functional/VirtualBaseNodeTest.php
index 1f8bf05..11103f8 100644
--- a/tests/src/Functional/VirtualBaseNodeTest.php
+++ b/tests/src/Functional/VirtualBaseNodeTest.php
@@ -2,11 +2,16 @@
 
 namespace Drupal\Tests\virtual_base\Functional;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
+
 /**
  * Tests help functionality for virtual base.
  *
  * @group virtual_base
  */
+#[Group('virtual_base')]
+#[RunTestsInSeparateProcesses]
 class VirtualBaseNodeTest extends VirtualBaseTestBase {
 
   /**
diff --git a/virtual_base.info.yml b/virtual_base.info.yml
index c5ab025..4d05c75 100644
--- a/virtual_base.info.yml
+++ b/virtual_base.info.yml
@@ -1,6 +1,6 @@
 name: 'Virtual Base'
 type: module
 description: 'Allows to access the website with a base prefix in the URL.'
-core_version_requirement: ^10 || ^11
+core_version_requirement: ^10.1 || ^11 || ^12
 package: 'Custom'
 configure: virtual_base.settings
diff --git a/virtual_base.module b/virtual_base.module
index 891c67a..ee83fd8 100644
--- a/virtual_base.module
+++ b/virtual_base.module
@@ -4,20 +4,17 @@
  * @file
  * Module file for virtual_base.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\virtual_base\Hook\VirtualBaseHooks;
 use Drupal\Core\Form\FormStateInterface;
 
 /**
  * Implements hook_form_alter().
  */
-function virtual_base_form_node_form_alter(&$form, &$form_state) {
-  $config = \Drupal::config('virtual_base.settings');
-  // Add clabback validate to virtual path prefix.
-  if (\Drupal::service('module_handler')
-    ->moduleExists('path_alias') && !empty($config) &&
-    $config->get('enabled') === TRUE) {
-    $form['#validate'][] = 'virtual_base_node_validate_alias';
-  }
+#[LegacyHook]
+function virtual_base_form_node_form_alter(&$form, &$form_state)
+{
+    \Drupal::service(VirtualBaseHooks::class)->formNodeFormAlter($form, $form_state);
 }
 
 /**
diff --git a/virtual_base.services.yml b/virtual_base.services.yml
index e3d1ec5..1ce846d 100644
--- a/virtual_base.services.yml
+++ b/virtual_base.services.yml
@@ -15,3 +15,7 @@ services:
     tags:
       - { name: cache.context }
     arguments: ['@virtual_base.manager']
+
+  Drupal\virtual_base\Hook\VirtualBaseHooks:
+    class: Drupal\virtual_base\Hook\VirtualBaseHooks
+    autowire: true
