diff --git a/composer.json b/composer.json
index d1c9d2080a1bf5e92f82f4a8b074cc17a510c212..f06714d52e487f9a48de3b8dcb21128d3bb0e497 100644
--- a/composer.json
+++ b/composer.json
@@ -26,15 +26,15 @@
     "require": {
         "ext-json": "*",
         "php": ">=7.2",
-        "composer-plugin-api": "^1.0.0",
+        "composer-plugin-api": "^1||^2",
         "lakedrops/composer-json-utils": "^1.5.0",
         "lakedrops/docker-traefik": "^1.2.0",
         "lakedrops/dotenv": "^1.2.2",
-        "twig/twig": "^1.23.1||^2.12"
+        "twig/twig": "^1.23.1"
     },
     "require-dev": {
-        "composer/composer": "^1.5.0",
-        "phpunit/phpunit": "^4.8.0"
+        "composer/composer": "^1||^2",
+        "phpunit/phpunit": "^8.4"
     },
     "minimum-stability": "dev",
     "prefer-stable": true,
diff --git a/src/Handler.php b/src/Handler.php
index 67ee29f1ea5ae45b6050843388678407aa72b937..9b58f83447d6b8774fe3b40c24337840adc0231c 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -2,11 +2,14 @@
 
 namespace LakeDrops\Docker4Drupal;
 
+use Exception;
 use LakeDrops\Component\Composer\BaseHandler;
 use LakeDrops\Component\Dotenv\Dotenv;
 use LakeDrops\DockerTraefik\Traefik;
 use Symfony\Component\Filesystem\Filesystem;
 use Symfony\Component\Yaml\Yaml;
+use Twig_Environment;
+use Twig_Loader_Array;
 
 /**
  * Class Handler.
@@ -26,9 +29,9 @@ class Handler extends BaseHandler {
    * @param bool $overwrite
    *   Whether to overwrite existing config files.
    *
-   * @throws \Twig_Error_Loader
-   * @throws \Twig_Error_Runtime
-   * @throws \Twig_Error_Syntax
+   * @throws \Twig\Error\LoaderError
+   * @throws \Twig\Error\RuntimeError
+   * @throws \Twig\Error\SyntaxError
    */
   public function configureProject($overwrite = FALSE) {
 
@@ -75,8 +78,8 @@ class Handler extends BaseHandler {
     }
 
     // Provide all the required files.
-    $twig_loader = new \Twig_Loader_Array([]);
-    $twig = new \Twig_Environment($twig_loader);
+    $twig_loader = new Twig_Loader_Array([]);
+    $twig = new Twig_Environment($twig_loader);
     $options['webRoot'] = $webRoot . '/';
     $orig_ignored = FALSE;
     foreach ($this->getFiles($projectRoot, $webRoot, $settingsPath, $options) as $template => $def) {
@@ -405,7 +408,7 @@ class Handler extends BaseHandler {
       exec('docker container inspect ' . $id, $output);
       return json_decode(implode('', $output), TRUE)[0];
     }
-    catch (\Exception $ex) {
+    catch (Exception $ex) {
       // Ignore.
     }
     return [
diff --git a/src/Plugin.php b/src/Plugin.php
index 5a8fdbc48d7488ff2fe4995f36e58651158e767d..74e33259afd0f5453510e946423a4a66fa218b3b 100644
--- a/src/Plugin.php
+++ b/src/Plugin.php
@@ -44,9 +44,9 @@ class Plugin extends BasePlugin {
    * @param \Composer\Script\Event $event
    *   The event that triggered the call of this function.
    *
-   * @throws \Twig_Error_Loader
-   * @throws \Twig_Error_Runtime
-   * @throws \Twig_Error_Syntax
+   * @throws \Twig\Error\LoaderError
+   * @throws \Twig\Error\RuntimeError
+   * @throws \Twig\Error\SyntaxError
    */
   public function configureProject(Event $event) {
     /** @var Handler $handler */
diff --git a/src/UpdateCommand.php b/src/UpdateCommand.php
index 951bc543b77952fa883606c7242ba4c1da15d05c..0f2664b5f963e5ab93e90635db2349830c354d35 100644
--- a/src/UpdateCommand.php
+++ b/src/UpdateCommand.php
@@ -26,9 +26,9 @@ class UpdateCommand extends BaseCommand {
   /**
    * {@inheritdoc}
    *
-   * @throws \Twig_Error_Loader
-   * @throws \Twig_Error_Runtime
-   * @throws \Twig_Error_Syntax
+   * @throws \Twig\Error\LoaderError
+   * @throws \Twig\Error\RuntimeError
+   * @throws \Twig\Error\SyntaxError
    */
   protected function execute(InputInterface $input, OutputInterface $output) {
     parent::execute($input, $output);