diff --git a/bootstrap_toggle.info.yml b/bootstrap_toggle.info.yml
index 898460d..7566d19 100644
--- a/bootstrap_toggle.info.yml
+++ b/bootstrap_toggle.info.yml
@@ -1,4 +1,4 @@
 name: Bootstrap Toggle
 description: Provides Bootstrap Toggle Button as a widget for boolean field.
 type: module
-core_version_requirement: ^8.9 || ^9 || ^10 || ^11
+core_version_requirement: ^10.1 || ^11 || ^12
diff --git a/bootstrap_toggle.install b/bootstrap_toggle.install
index e882dee..fc3b5f1 100644
--- a/bootstrap_toggle.install
+++ b/bootstrap_toggle.install
@@ -4,7 +4,8 @@
  * @file
  * Install file.
  */
-
+use Drupal\Component\Utility\DeprecationHelper;
+use Drupal\Core\Extension\Requirement\RequirementSeverity;
 use Drupal\Core\Url;
 use Drupal\Core\Link;
 
@@ -34,7 +35,7 @@ function bootstrap_toggle_requirements($phase) {
       $requirements['bootstrap_toggle'] = [
         'title' => t('Bootstrap Toggle Library'),
         'value' => t('Missing bootstrap_toggle library!'),
-        'severity' => REQUIREMENT_ERROR,
+        'severity' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.2.0', fn() => RequirementSeverity::Error, fn() => REQUIREMENT_ERROR),
         'description' => t('In oder to use bootstrap_toggle buttons you need to download the %library library, extract the archive, rename and place the %folder directory in the %path directory under the docroot of your site.', [
           '%library' => $library_download_link->toString(),
           '%folder' => 'bootstrap_toggle',
diff --git a/bootstrap_toggle.module b/bootstrap_toggle.module
index 0ea31ee..82058ee 100644
--- a/bootstrap_toggle.module
+++ b/bootstrap_toggle.module
@@ -4,61 +4,34 @@
  * @file
  * This module provides a toggle widget for boolean field type.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\bootstrap_toggle\Hook\BootstrapToggleHooks;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Url;
 
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function bootstrap_toggle_help($route_name, $route_match) {
 
-  switch ($route_name) {
-    case 'help.page.bootstrap_toggle':
-      $output = '';
-      $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t('The Bootstrap Toggle module provides a toggle widget for a Boolean field type using the <a href="@vendor" target="_new">Bootstrap Toggle</a> library.', ['@vendor' => Url::fromUri('http://www.bootstraptoggle.com')->getUri()]) . '</p>';
-      $output .= '<h3>' . t('Installation') . '</h3>';
-      $output .= '<p>' . t('You are advised to install this module by using <em>composer</em>.') . '</p>';
-      $output .= '<p>' . t('If you are not using composer to manage your project, you will need to download bootstrap toggle library from <a href="@download" target="_new">here</a> and install it manually. ', ['@download' => Url::fromUri('https://github.com/minhur/bootstrap-toggle/archive/master.zip')->getUri()]);
-      $output .= '<p>' . t('Download, extract and place the library under <em>libraries</em> folder in docroot and rename the extracted folder to <em>bootstrap_toggle</em>.') . '</p>';
-      $output .= '<p>' . t('For instructions on how to manage the bootstrap toggle library with composer please see the <em>README.txt</em> file.') . '</p>';
-      $output .= '<p>' . t('This module requires bootstrap based theme for add/edit pages to work properly, for example <a href="@theme3" target="_new">Bootstrap 3</a> or <a href="@theme4" target="_new">Bootstrap 4</a>. ', ['@theme3' => Url::fromUri('https://www.drupal.org/project/bootstrap')->getUri(), '@theme4' => Url::fromUri('https://www.drupal.org/project/bootstrap4')->getUri()]);
-      $output .= t('So make sure you have a bootstrap theme as default theme and don\'t use your admin theme for add/edit pages if you use any.') . '</p>';
-      $output .= '<h3>' . t('Configuration') . '</h3>';
-      $output .= '<ol>';
-      $output .= '<li>' . t('Go to <em>manage fields</em> of the content type you wish to have a toggle button and add a Boolean field.') . '</li>';
-      $output .= '<li>' . t('Go to <em>manage form display</em> tab and under widget column select <em>Bootstrap Toggle</em> for your field.') . '</li>';
-      $output .= '<li>' . t('Configure the settings for that toggle button and update those settings.') . '</li>';
-      $output .= '<li>' . t('Finally save the manage form display and you are done.') . '</li>';
-      $output .= '</ol>';
-      $output .= '<p>' . t('Try out different combination of settings to get a different look of toggle button.') . '</p>';
-
-      return $output;
-  }
+  return \Drupal::service(BootstrapToggleHooks::class)->help($route_name, $route_match);
 }
 
 /**
  * Implements hook_form_alter().
  */
+#[LegacyHook]
 function bootstrap_toggle_form_alter(&$form, FormStateInterface $form_state, $form_id) {
-  // Check for the flag we set in the widget.
-  if ($form_state->has('attached_toggle') && $form_state->get('attached_toggle') == TRUE) {
-    // Attach the Bootstrap Toggle library.
-    $form['#attached']['library'][] = 'bootstrap_toggle/bootstrap_toggle';
-  }
+  \Drupal::service(BootstrapToggleHooks::class)->formAlter($form, $form_state, $form_id);
 }
 
 /**
  * Implements hook_theme().
  */
+#[LegacyHook]
 function bootstrap_toggle_theme($existing, $type, $theme, $path) {
-  return [
-    'form_element_label__toggle' => [
-      'base hook' => 'form-element-label',
-      'template' => 'form-element-label--toggle',
-    ],
-  ];
+  return \Drupal::service(BootstrapToggleHooks::class)->theme($existing, $type, $theme, $path);
 }
 
 /**
@@ -66,12 +39,9 @@ function bootstrap_toggle_theme($existing, $type, $theme, $path) {
  *
  * Theme suggestion for form_element__toggle checkboxes.
  */
+#[LegacyHook]
 function bootstrap_toggle_theme_suggestions_form_element_alter(array &$suggestions, array $variables) {
-  if ($variables['element']['#type'] == 'checkbox') {
-    if (isset($variables['element']['#attributes']['data-toggle']) && in_array('toggle', $variables['element']['#attributes']['data-toggle'])) {
-      $suggestions[] = 'form_element__toggle';
-    }
-  }
+  \Drupal::service(BootstrapToggleHooks::class)->themeSuggestionsFormElementAlter($suggestions, $variables);
 }
 
 /**
diff --git a/bootstrap_toggle.services.yml b/bootstrap_toggle.services.yml
new file mode 100644
index 0000000..364299a
--- /dev/null
+++ b/bootstrap_toggle.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\bootstrap_toggle\Hook\BootstrapToggleHooks:
+    class: Drupal\bootstrap_toggle\Hook\BootstrapToggleHooks
+    autowire: true
diff --git a/composer.json b/composer.json
index 9822fc3..c4366e0 100644
--- a/composer.json
+++ b/composer.json
@@ -22,6 +22,6 @@
     }
   ],
   "require": {
-    "drupal/core": "^8.9 || ^9 || ^10 || ^11"
+    "drupal/core": "^10.1 || ^11 || ^12"
   }
 }
diff --git a/src/Hook/BootstrapToggleHooks.php b/src/Hook/BootstrapToggleHooks.php
new file mode 100644
index 0000000..c3cdb62
--- /dev/null
+++ b/src/Hook/BootstrapToggleHooks.php
@@ -0,0 +1,90 @@
+<?php
+
+namespace Drupal\bootstrap_toggle\Hook;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for bootstrap_toggle.
+ */
+class BootstrapToggleHooks
+{
+    use StringTranslationTrait;
+    /**
+     * Implements hook_help().
+     */
+    #[Hook('help')]
+    public function help($route_name, $route_match)
+    {
+        switch ($route_name) {
+            case 'help.page.bootstrap_toggle':
+                $output = '';
+                $output .= '<h3>' . $this->t('About') . '</h3>';
+                $output .= '<p>' . $this->t('The Bootstrap Toggle module provides a toggle widget for a Boolean field type using the <a href="@vendor" target="_new">Bootstrap Toggle</a> library.', [
+                    '@vendor' => \Drupal\Core\Url::fromUri('http://www.bootstraptoggle.com')->getUri(),
+                ]) . '</p>';
+                $output .= '<h3>' . $this->t('Installation') . '</h3>';
+                $output .= '<p>' . $this->t('You are advised to install this module by using <em>composer</em>.') . '</p>';
+                $output .= '<p>' . $this->t('If you are not using composer to manage your project, you will need to download bootstrap toggle library from <a href="@download" target="_new">here</a> and install it manually. ', [
+                    '@download' => \Drupal\Core\Url::fromUri('https://github.com/minhur/bootstrap-toggle/archive/master.zip')->getUri(),
+                ]);
+                $output .= '<p>' . $this->t('Download, extract and place the library under <em>libraries</em> folder in docroot and rename the extracted folder to <em>bootstrap_toggle</em>.') . '</p>';
+                $output .= '<p>' . $this->t('For instructions on how to manage the bootstrap toggle library with composer please see the <em>README.txt</em> file.') . '</p>';
+                $output .= '<p>' . $this->t('This module requires bootstrap based theme for add/edit pages to work properly, for example <a href="@theme3" target="_new">Bootstrap 3</a> or <a href="@theme4" target="_new">Bootstrap 4</a>. ', [
+                    '@theme3' => \Drupal\Core\Url::fromUri('https://www.drupal.org/project/bootstrap')->getUri(),
+                    '@theme4' => \Drupal\Core\Url::fromUri('https://www.drupal.org/project/bootstrap4')->getUri(),
+                ]);
+                $output .= $this->t('So make sure you have a bootstrap theme as default theme and don\'t use your admin theme for add/edit pages if you use any.') . '</p>';
+                $output .= '<h3>' . $this->t('Configuration') . '</h3>';
+                $output .= '<ol>';
+                $output .= '<li>' . $this->t('Go to <em>manage fields</em> of the content type you wish to have a toggle button and add a Boolean field.') . '</li>';
+                $output .= '<li>' . $this->t('Go to <em>manage form display</em> tab and under widget column select <em>Bootstrap Toggle</em> for your field.') . '</li>';
+                $output .= '<li>' . $this->t('Configure the settings for that toggle button and update those settings.') . '</li>';
+                $output .= '<li>' . $this->t('Finally save the manage form display and you are done.') . '</li>';
+                $output .= '</ol>';
+                $output .= '<p>' . $this->t('Try out different combination of settings to get a different look of toggle button.') . '</p>';
+                return $output;
+        }
+    }
+    /**
+     * Implements hook_form_alter().
+     */
+    #[Hook('form_alter')]
+    public function formAlter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
+    {
+        // Check for the flag we set in the widget.
+        if ($form_state->has('attached_toggle') && $form_state->get('attached_toggle') == TRUE) {
+            // Attach the Bootstrap Toggle library.
+            $form['#attached']['library'][] = 'bootstrap_toggle/bootstrap_toggle';
+        }
+    }
+    /**
+     * Implements hook_theme().
+     */
+    #[Hook('theme')]
+    public function theme($existing, $type, $theme, $path)
+    {
+        return [
+            'form_element_label__toggle' => [
+                'base hook' => 'form-element-label',
+                'template' => 'form-element-label--toggle',
+            ],
+        ];
+    }
+    /**
+     * Implements hook_theme_suggestions_form_element_alter().
+     *
+     * Theme suggestion for form_element__toggle checkboxes.
+     */
+    #[Hook('theme_suggestions_form_element_alter')]
+    public function themeSuggestionsFormElementAlter(array &$suggestions, array $variables)
+    {
+        if ($variables['element']['#type'] == 'checkbox') {
+            if (isset($variables['element']['#attributes']['data-toggle']) && in_array('toggle', $variables['element']['#attributes']['data-toggle'])) {
+                $suggestions[] = 'form_element__toggle';
+            }
+        }
+    }
+}
