public static function downloadPackage($package_file, $tmp)
    {
        $package = parse_url($package_file);
        $filename = basename($package['path']);

        if (Grav::instance()['config']->get('system.gpm.official_gpm_only') && $package['host'] !== 'getgrav.org') {
            throw new \RuntimeException("Only official GPM URLs are allowed. You can modify this behavior in the System configuration.");
        }

        $output = Response::get($package_file, []);

        if ($output) {
            Folder::create($tmp);
            file_put_contents($tmp . DS . $filename, $output);
            return $tmp . DS . $filename;
        }

        return null;
    }