diff --git a/src/Hook/SynmapHooks.php b/src/Hook/SynmapHooks.php
new file mode 100644
index 0000000..ca89461
--- /dev/null
+++ b/src/Hook/SynmapHooks.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\synmap\Hook;
+
+use Drupal\Core\Hook\Attribute\Hook;
+
+/**
+ * Hook implementations for synmap.
+ */
+class SynmapHooks {
+  /**
+   * @file
+   * Module synmap.module.
+   */
+
+  /**
+   * Implements hook_page_attachments().
+   *
+   * @param array{'#attached'?: array{library?: list<string>, drupalSettings?: array<string, array<string, mixed>>}} $page
+   *   The page attachments render array.
+   */
+  #[Hook('page_attachments')]
+  public function pageAttachments(array &$page): void {
+    \Drupal::service('synmap.page_attachments')->hook($page);
+  }
+
+}
diff --git a/synmap.module b/synmap.module
index 98b68c2..6974b5e 100644
--- a/synmap.module
+++ b/synmap.module
@@ -1,5 +1,8 @@
 <?php
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\synmap\Hook\SynmapHooks;
+
 /**
  * @file
  * Module synmap.module.
@@ -11,6 +14,7 @@
  * @param array{'#attached'?: array{library?: list<string>, drupalSettings?: array<string, array<string, mixed>>}} $page
  *   The page attachments render array.
  */
+#[LegacyHook]
 function synmap_page_attachments(array &$page): void {
-  \Drupal::service('synmap.page_attachments')->hook($page);
+  \Drupal::service(SynmapHooks::class)->pageAttachments($page);
 }
diff --git a/synmap.services.yml b/synmap.services.yml
index 7f751ed..31f6cff 100644
--- a/synmap.services.yml
+++ b/synmap.services.yml
@@ -8,3 +8,7 @@ services:
       - '@language_manager'
       - '@path.matcher'
       - '@module_handler'
+
+  Drupal\synmap\Hook\SynmapHooks:
+    class: Drupal\synmap\Hook\SynmapHooks
+    autowire: true
