diff --git a/session_token.info b/session_token.info
deleted file mode 100644
index addacc2..0000000
--- a/session_token.info
+++ /dev/null
@@ -1,5 +0,0 @@
-name = Session Token
-description = Use values from $_SESSION as tokens.
-core = 7.x
-
-dependencies[] = token
diff --git a/session_token.info.yml b/session_token.info.yml
new file mode 100644
index 0000000..3afa7ac
--- /dev/null
+++ b/session_token.info.yml
@@ -0,0 +1,5 @@
+name: Session Token
+type: module
+description: 'Tokenize session values'
+dependencies:
+core: 8.x
diff --git a/session_token.module b/session_token.module
deleted file mode 100644
index 39ad8e4..0000000
--- a/session_token.module
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-
-/**
- * @file
- * Provides the functionality to retrieve $_SESSION information using tokens.
- */
-
-define('SESSION_TOKEN_STORAGE_KEY', '#token_storage');
-
-
-/**
- * Implements hook_help().
- */
-function session_token_help($path, $arg) {
-  switch ($path) {
-    case 'admin/help#session_token':
-      $filepath = dirname(__FILE__) . '/README.md';
-      if (file_exists($filepath)) {
-        $readme = file_get_contents($filepath);
-      }
-      if (!isset($readme)) {
-        return NULL;
-      }
-      if (module_exists('markdown')) {
-        $filters = module_invoke('markdown', 'filter_info');
-        $info = $filters['filter_markdown'];
-
-        if (function_exists($info['process callback'])) {
-          $output = $info['process callback']($readme, NULL);
-        }
-        else {
-          $output = '<pre>' . $readme . '</pre>';
-        }
-      }
-      else {
-        $output = '<pre>' . $readme . '</pre>';
-      }
-
-      return $output;
-  }
-}
-
-
-/**
- * Implements hook_token_info().
- *
- * This hook will register tow token lname and fname.
- */
-function post_token_token_info() {
-  $info['tokens']['current-page']['session'] = array(
-    'name' => t('Posted values'),
-    'description' => t('Values that have been posted by the user.'),
-    'dynamic' => TRUE,
-  );
-  return $info;
-}
-
-/**
- * Implements hook_token_info().
- *
- * This hook will register tow token lname and fname.
- */
-function session_token_token_info() {
-  $info['tokens']['current-page']['session'] = array(
-    'name' => t('Session values'),
-    'description' => t("Values that are stored in the user's session."),
-    'dynamic' => TRUE,
-  );
-  return $info;
-}
-
-/**
- * Provide replacement values for placeholder tokens.
- *
- * @param string $type
- *   The machine-readable name of the type (group) of token being replaced, such
- *   as 'node', 'user', or another type defined by a hook_token_info()
- *   implementation.
- * @param array $tokens
- *   An array of tokens to be replaced. The keys are the machine-readable token
- *   names, and the values are the raw [type:token] strings that appeared in the
- *   original text.
- * @param array $data
- *   (optional) An associative array of data objects to be used when generating
- *   replacement values, as supplied in the $data parameter to token_replace().
- * @param array $options
- *   (optional) An associative array of options for token replacement; see
- *   token_replace() for possible values.
- *
- * @see httx://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_tokens/7
- * @see httx://api.lullabot.com/token_example_tokens/7
- *
- * @return array
- *   An associative array of replacement values, keyed by the raw [type:token]
- *   strings from the original text.
- */
-function session_token_tokens($type, array $tokens, array $data = array(), array $options = array()) {
-  $replacements = array();
-
-  $sanitize = !empty($options['sanitize']);
-
-  // Current page tokens.
-  if ($type == 'current-page') {
-    if ($query_tokens = token_find_with_prefix($tokens, 'session')) {
-      foreach ($query_tokens as $name => $original) {
-        // @todo Should this use filter_input()?
-        $replacement = session_token_get($name);
-        if (!empty($replacement)) {
-          $replacements[$original] = $sanitize ? check_plain($replacement) : $replacement;
-        }
-      }
-    }
-  }
-
-  return $replacements;
-}
-
-/**
- * Get a token from the storage.
- *
- * @param string $key
- *   The key of the storage to retrieve the value from.
- *
- * @return array|string
- *   Will return an empty string if no item is found in the storage. Otherwise
- *   the value which is stored in the storage. This can be either a string or
- *   an array.
- */
-function session_token_get($key) {
-  $return = "";
-  if (is_array($key)) {
-    foreach ($key as $new_key) {
-      $return[$new_key] = session_token_get($new_key);
-    }
-  }
-  else {
-    if (isset($_SESSION[SESSION_TOKEN_STORAGE_KEY][$key])) {
-      $return = $_SESSION[SESSION_TOKEN_STORAGE_KEY][$key];
-    }
-  }
-  return $return;
-}
-
-/**
- * Store a value in the token storage.
- *
- * @param string $key
- *   The key of the storage where the value needs to be stored.
- * @param string $value
- *   The value that needs to be stored inside the storage. Can be an array (for
- *   storing multidimensional values) or a just a string.
- */
-function session_token_set($key, $value) {
-  $_SESSION[SESSION_TOKEN_STORAGE_KEY][$key] = $value;
-}
diff --git a/session_token.tokens.inc b/session_token.tokens.inc
new file mode 100644
index 0000000..e6191a3
--- /dev/null
+++ b/session_token.tokens.inc
@@ -0,0 +1,53 @@
+<?php
+
+use Drupal\Core\Render\BubbleableMetadata;
+
+/**
+ * Implements hook_token_info().
+ */
+function session_token_token_info() {
+  $session = \Drupal::request()->getSession();
+
+  if ($session) {
+    $types = [];
+
+    $types['session'] = [
+      'name' => t('Session Tokens'),
+      'description' => t('Tokens for session variables.'),
+    ];
+
+    $tokens = $session->all();
+    array_walk($tokens, function(&$item, $key) {
+      $item = [
+        'name' => $key,
+        'description' => $key,
+      ];
+    });
+
+    return [
+      'types' => $types,
+      'tokens' => ['session' => $tokens],
+    ];
+  }
+}
+
+/**
+* Implements hook_tokens().
+*/
+function session_token_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
+  $replacements = [];
+  $sanitize = !empty($options['sanitize']);
+
+  if ($type == 'session') {
+    $session = \Drupal::request()->getSession();
+    $session_vars = $session->all();
+
+    foreach ($tokens as $name => $original) {
+      if (array_key_exists($name, $session_vars)) {
+        $replacements[$original] = $sanitize ? check_plain($session_vars[$name]) : $session_vars[$name];
+      }
+    }
+  }
+
+  return $replacements;
+}
