diff --git a/backup_db.info.yml b/backup_db.info.yml
index 567be46..fb2a181 100644
--- a/backup_db.info.yml
+++ b/backup_db.info.yml
@@ -3,5 +3,6 @@ type: module
 description: 'Provides database backup solutions.'
 package: Development
 # core: 8.x
+core_version_requirement: ^8 || ^9
 tags:
  - developer
diff --git a/backup_db.module b/backup_db.module
index e36f77d..23fd57b 100755
--- a/backup_db.module
+++ b/backup_db.module
@@ -1,5 +1,6 @@
 <?php
 
+use Drupal\Core\Database\Database;
 /**
  * @file
  * backup_db.module
@@ -12,14 +13,14 @@ use Drupal\backup_db\Adapter\BackupDatabaseLocalAdapter;
  * Inserts an export entry.
  */
 function backup_db_history_insert($file) {
-  $connection = \Drupal\Core\Database\Database::getConnection();
+  $connection = Database::getConnection();
   return $connection->insert('backup_db')
     ->fields(array('fid', 'name', 'uri', 'created'))
     ->values(array(
       'fid' => $file['fid'],
       'name' => $file['name'],
       'uri' => $file['uri'],
-      'created' => REQUEST_TIME
+      'created' => \Drupal::time()->getRequestTime()
     ))
     ->execute();
 }
@@ -28,7 +29,7 @@ function backup_db_history_insert($file) {
  * Return export history entry.
  */
 function backup_db_history_load($id) {
-  $connection = \Drupal\Core\Database\Database::getConnection();
+  $connection = Database::getConnection();
   return $connection->query('SELECT * FROM {backup_db} WHERE eid = :id', array(':id' => $id))->fetchAll();
 }
 
@@ -38,19 +39,21 @@ function backup_db_history_load($id) {
 function backup_db_history_delete($id) {
   // Remove backup_db entry.
   // @todo, use injected db service.
-  db_delete('backup_db')
+  // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+  // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+  \Drupal::database()->delete('backup_db')
     ->condition('fid', $id)
     ->execute();
 
   // Remove file and managed entry.
-  return file_delete($id);
+  return \Drupal\Core\Entity\EntityStorageInterface::delete($id);
 }
 
 /**
  * Return list of all tables.
  */
 function backup_db_show_tables() {
-  $connection = \Drupal\Core\Database\Database::getConnection();
+  $connection = Database::getConnection();
   return $connection->query('SHOW TABLES')->fetchAll();
 }
 
@@ -90,10 +93,10 @@ function backup_db_cron() {
   if ($config->get('cron_backup_enabled')) {
     $interval = (int) $config->get('cron_interval') * 60 * 60;
 
-    $expires = Drupal::state()->get('backup_db.cron_last_run') ? : REQUEST_TIME;
+    $expires = Drupal::state()->get('backup_db.cron_last_run') ? : \Drupal::time()->getRequestTime();
     $next = Drupal::state()->get('backup_db.cron_next_backup') ? : $expires + $interval;
 
-    if (REQUEST_TIME > $next) {
+    if (\Drupal::time()->getRequestTime() > $next) {
       $client = \Drupal::service('backup_db.client');
 
       // Use the local adapter for cron export.
@@ -110,6 +113,6 @@ function backup_db_cron() {
       }*/
     }
 
-    Drupal::state()->set('backup_db.cron_last_run', REQUEST_TIME);
+    Drupal::state()->set('backup_db.cron_last_run', \Drupal::time()->getRequestTime());
   }
 }
diff --git a/src/Adapter/BackupDatabaseLocalAdapter.php b/src/Adapter/BackupDatabaseLocalAdapter.php
index 5337ce7..8d28616 100755
--- a/src/Adapter/BackupDatabaseLocalAdapter.php
+++ b/src/Adapter/BackupDatabaseLocalAdapter.php
@@ -9,6 +9,7 @@ namespace Drupal\backup_db\Adapter;
 
 use Drupal\backup_db\Adapter\BackupDatabaseAdapterInterface;
 use Drupal\backup_db\BackupDatabaseClientInterface;
+use Drupal\file\Entity\File;
 
 /**
  * BackupDatabaseLocalAdapter class.
@@ -38,7 +39,7 @@ class BackupDatabaseLocalAdapter implements BackupDatabaseAdapterInterface {
     $user = \Drupal::currentUser();
 
     // Create a file entity.
-    $entity = entity_create('file', array(
+    $entity = \Drupal::service('entity_type.manager')->getStorage('file')->create(array(
       'uri' => $file->getFileUri(),
       'uid' => $user->id(),
       'status' => FILE_STATUS_PERMANENT,
diff --git a/src/BackupDatabaseFileHandler.php b/src/BackupDatabaseFileHandler.php
index 909dc81..dd8eb62 100755
--- a/src/BackupDatabaseFileHandler.php
+++ b/src/BackupDatabaseFileHandler.php
@@ -7,8 +7,10 @@
 
 namespace Drupal\backup_db;
 
+use Drupal\Core\File\FileSystemInterface;
 use Drupal\Core\File\FileSystem;
 use Drupal\backup_db\BackupDatabaseFile;
+use Drupal\Core\File\FileSystemInterface;
 
 /**
  * BackupDatabaseFileHandler class.
@@ -54,7 +56,7 @@ class BackupDatabaseFileHandler {
     $extension = $this->createFileType();
 
     $this->file->setFileName($this->config['name'] . '_' . time() . $extension);
-    $this->file->setFileUri(file_create_filename(
+    $this->file->setFileUri(createFilename(
       $this->file->getFileName(), $path
     ));
   }
@@ -103,7 +105,7 @@ class BackupDatabaseFileHandler {
   private function createFilePath() {
     $result = $this->config['path'];
 
-    if (!file_prepare_directory($result, FILE_CREATE_DIRECTORY)) {
+    if (!\Drupal::service('file_system')->prepareDirectory($result, FileSystemInterface::CREATE_DIRECTORY)) {
       $result = FALSE;
 
       \Drupal::logger('backup_db')->error('The requested directory @dir could not be created.',
@@ -112,7 +114,7 @@ class BackupDatabaseFileHandler {
         )
       );
     }
-    else if (!file_prepare_directory($result)) {
+    else if (!\Drupal::service('file_system')->prepareDirectory($result)) {
       $result = FALSE;
 
       \Drupal::logger('backup_db')->error('The requested directory @dir permissions are not writable.',
@@ -125,7 +127,7 @@ class BackupDatabaseFileHandler {
     if ($this->config['date']) {
       $filepath = $this->config['path'] . '/' . $this->config['date'];
 
-      if (file_prepare_directory($filepath, FILE_CREATE_DIRECTORY)) {
+      if (\Drupal::service('file_system')->prepareDirectory($filepath, FileSystemInterface::CREATE_DIRECTORY)) {
         $result = $filepath;
       }
     }
diff --git a/src/Controller/BackupDatabaseController.php b/src/Controller/BackupDatabaseController.php
index 3c0b983..865b271 100755
--- a/src/Controller/BackupDatabaseController.php
+++ b/src/Controller/BackupDatabaseController.php
@@ -7,8 +7,10 @@
 
 namespace Drupal\backup_db\Controller;
 
+use Drupal\Core\Link;
 use Drupal\Core\Url;
 use Drupal\Core\Controller\ControllerBase;
 
 /**
  * Display database backup history.
@@ -19,7 +21,9 @@ class BackupDatabaseController extends ControllerBase {
    * {@inheritdoc}
    */
   public function historyOverview() {
-    $query = db_select('backup_db', 'e');
+    // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+    // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+    $query = \Drupal::database()->select('backup_db', 'e');
     $count_query = clone $query;
     $count_query->addExpression('Count(e.eid)');
 
@@ -37,7 +41,7 @@ class BackupDatabaseController extends ControllerBase {
     $rows = array();
     foreach ($results as $result) {
       $url = backup_db_link($result->uri);
-      $location = \Drupal::l($result->uri, Url::fromUri('base:/'.file_create_url($url)));
+      $location = Link::fromTextAndUrl($result->uri, Url::fromUri('base:/'.file_create_url($url)));
       $created = \Drupal::service('date.formatter')->format($result->created, 'html_date');
 
       $rows[$result->fid] = array(
diff --git a/src/Form/BackupDatabaseCronForm.php b/src/Form/BackupDatabaseCronForm.php
index 5a2dd3f..f2207b7 100755
--- a/src/Form/BackupDatabaseCronForm.php
+++ b/src/Form/BackupDatabaseCronForm.php
@@ -65,6 +65,6 @@ class BackupDatabaseCronForm extends ConfigFormBase {
       ->set('cron_backup_enabled', $form_state->getValue('cron_backup_enabled'))
       ->save();
 
-    \Drupal::state()->set('backup_db.cron_next_backup', REQUEST_TIME + ($form_state->getValue('cron_interval') * 60));
+    \Drupal::state()->set('backup_db.cron_next_backup', \Drupal::time()->getRequestTime() + ($form_state->getValue('cron_interval') * 60));
   }
 }
diff --git a/src/Form/BackupDatabaseForm.php b/src/Form/BackupDatabaseForm.php
index e9ba957..a480c47 100755
--- a/src/Form/BackupDatabaseForm.php
+++ b/src/Form/BackupDatabaseForm.php
@@ -89,10 +89,10 @@ class BackupDatabaseForm extends FormBase {
 
     // Run the export.
     if ($handler->export()) {
-      drupal_set_message(t('Backup has been successfully completed.'), 'status');
+      $this->messenger()->addStatus(t('Backup has been successfully completed.'));
     }
     else {
-      drupal_set_message(t('Backup has failed, please review recent log messages.'), 'warning');
+      $this->messenger()->addWarning(t('Backup has failed, please review recent log messages.'));
     }
   }
 }
diff --git a/src/Form/BackupDatabaseSettingsForm.php b/src/Form/BackupDatabaseSettingsForm.php
index 475c042..3133a83 100755
--- a/src/Form/BackupDatabaseSettingsForm.php
+++ b/src/Form/BackupDatabaseSettingsForm.php
@@ -48,7 +48,7 @@ class BackupDatabaseSettingsForm extends ConfigFormBase {
     $date_formatter = \Drupal::service('date.formatter');
     $date_format_options = array();
     foreach ($date_types as $machine_name => $format) {
-      $date_format_options[$machine_name] = t('@name - @sample', array('@name' => $format->label(), '@sample' => $date_formatter->format(REQUEST_TIME, $machine_name)));
+      $date_format_options[$machine_name] = t('@name - @sample', array('@name' => $format->label(), '@sample' => $date_formatter->format(\Drupal::time()->getRequestTime(), $machine_name)));
     }
     $form['date'] = array(
       '#type' => 'select',
@@ -211,7 +211,7 @@ class BackupDatabaseSettingsForm extends ConfigFormBase {
       }
       else {
         // Warn user that it should be private.
-        drupal_set_message(t('Private directory is not set and should be used for backup storage.'), 'warning');  
+        $this->messenger()->addWarning(t('Private directory is not set and should be used for backup storage.'));  
       }
     }
   }

