diff --git a/templates/code_quality/phpstan/template.yml b/templates/code_quality/phpstan/template.yml
index 8e6041b86257f066c28622d4064432777320fb0d..34ce7a9279752d61054fae21d00c22b6898c98ac 100644
--- a/templates/code_quality/phpstan/template.yml
+++ b/templates/code_quality/phpstan/template.yml
@@ -7,11 +7,13 @@ variables:
     - .cache
     - .code_quality_default
   before_script:
-    - mkdir -p .toolbox/  
+    - mkdir -p .toolbox/
+    - ${COMPOSER_BIN} init --working-dir=.toolbox/ --name=drupal/gitlab-toolbox -n
+    - ${COMPOSER_BIN} config --working-dir=.toolbox/ --no-plugins allow-plugins.phpstan/extension-installer true
     - ${COMPOSER_BIN} require --working-dir=.toolbox/ --no-interaction --ignore-platform-reqs --no-progress mglaman/phpstan-drupal
     - test -f phpstan.neon.dist || curl -OL --create-dirs  --output-dir .toolbox/ ${TOOLBOX_REF_URL}/templates/code_quality/phpstan/phpstan.neon.dist
   script:
-    - .toolbox/vendor/bin/phpstan
+    - ${BIN_DIR}/phpstan
       analyse
       --configuration=.toolbox/phpstan.neon.dist
       --memory-limit 2G