diff --git a/build.sh b/build.sh
index 8d9715a1e1d03723c17fbb8678a849df21fb713e..efb0a1a2aef89277d6aa030165893812237f5a21 100755
--- a/build.sh
+++ b/build.sh
@@ -1,11 +1,25 @@
 #!/usr/bin/env sh
 
+# Creates a folder to zip.
 rm -f xapi.zip
-composer install --no-interaction --no-dev
+php -r "readfile('https://getcomposer.org/installer');" | php
+php composer.phar install --no-interaction --no-dev
 cp -r . ../moodle_logstore_build
+
+# Removes unused files and folders.
+find ../moodle_logstore_build -type d -name 'tests' | xargs rm -rf
+find ../moodle_logstore_build -type d -name 'docs' | xargs rm -rf
+find ../moodle_logstore_build -type d -name '.git' | xargs rm -rf
+find ../moodle_logstore_build -type f -name 'composer.*' | xargs rm -rf
+find ../moodle_logstore_build -type f -name 'phpunit.*' | xargs rm -rf
+find ../moodle_logstore_build -type f -name '*.md' | xargs rm -rf
+
+# Creates the zip file.
 mv ../moodle_logstore_build xapi
 zip -r xapi.zip xapi -x "xapi/.git/**/*"
 rm -rf xapi
+
+# Updates Github.
 git add xapi.zip
 git commit -m "Builds zip file."
 git push