diff --git a/script_manager.module b/script_manager.module
index feff4d4..2ac3f9d 100644
--- a/script_manager.module
+++ b/script_manager.module
@@ -7,21 +7,23 @@
 
 declare(strict_types = 1);
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\script_manager\Hook\ScriptManagerHooks;
 use Drupal\script_manager\Entity\ScriptInterface;
 use Drupal\script_manager\ScriptPlacementManager;
 
 /**
  * Implements hook_page_bottom().
  */
+#[LegacyHook]
 function script_manager_page_bottom(array &$page): void {
-  $page['script_manager'] = \Drupal::classResolver(ScriptPlacementManager::class)
-    ->getRenderedScriptsForPosition(ScriptInterface::POSITION_BOTTOM);
+  \Drupal::service(ScriptManagerHooks::class)->pageBottom($page);
 }
 
 /**
  * Implements hook_page_top().
  */
+#[LegacyHook]
 function script_manager_page_top(array &$page): void {
-  $page['script_manager'] = \Drupal::classResolver(ScriptPlacementManager::class)
-    ->getRenderedScriptsForPosition(ScriptInterface::POSITION_TOP);
+  \Drupal::service(ScriptManagerHooks::class)->pageTop($page);
 }
diff --git a/script_manager.services.yml b/script_manager.services.yml
new file mode 100644
index 0000000..0f329ce
--- /dev/null
+++ b/script_manager.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\script_manager\Hook\ScriptManagerHooks:
+    class: Drupal\script_manager\Hook\ScriptManagerHooks
+    autowire: true
diff --git a/src/Hook/ScriptManagerHooks.php b/src/Hook/ScriptManagerHooks.php
new file mode 100644
index 0000000..7a0bf09
--- /dev/null
+++ b/src/Hook/ScriptManagerHooks.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Drupal\script_manager\Hook;
+
+use Drupal\script_manager\Entity\ScriptInterface;
+use Drupal\script_manager\ScriptPlacementManager;
+use Drupal\Core\Hook\Attribute\Hook;
+/**
+ * Hook implementations for script_manager.
+ */
+class ScriptManagerHooks
+{
+    /**
+     * Implements hook_page_bottom().
+     */
+    #[Hook('page_bottom')]
+    public static function pageBottom(array &$page): void
+    {
+        $page['script_manager'] = \Drupal::classResolver(\Drupal\script_manager\ScriptPlacementManager::class)->getRenderedScriptsForPosition(\Drupal\script_manager\Entity\ScriptInterface::POSITION_BOTTOM);
+    }
+    /**
+     * Implements hook_page_top().
+     */
+    #[Hook('page_top')]
+    public static function pageTop(array &$page): void
+    {
+        $page['script_manager'] = \Drupal::classResolver(\Drupal\script_manager\ScriptPlacementManager::class)->getRenderedScriptsForPosition(\Drupal\script_manager\Entity\ScriptInterface::POSITION_TOP);
+    }
+}
