Fixing composer.json autoload, checking writable temp dir and fixing closure usage