fn new(version: &str, is_zts: bool, arch: Arch) -> Result<DevelPack> {
        // If the PHP version is more than 8.4.1, use VS17 instead of VS16.
        let version_float = version
            .split('.')
            .take(2)
            .collect::<Vec<_>>()
            .join(".")
            .parse::<f32>()
            .context("Failed to parse PHP version as float")?;

        // PHP builds switched to VS17 in PHP 8.4.1.
        let visual_studio_version = if version_float >= 8.4f32 {
            "vs17"
        } else {
            "vs16"
        };

        let zip_name = format!(
            "php-devel-pack-{}{}-Win32-{}-{}.zip",
            version,
            if is_zts { "" } else { "-nts" },
            visual_studio_version,
            arch
        );

        fn download(zip_name: &str, archive: bool) -> Result<PathBuf> {
            let out_dir = PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
            let url = format!(
                "https://windows.php.net/downloads/releases{}/{}",
                if archive { "/archives" } else { "" },
                zip_name
            );
            let response = ureq::Agent::config_builder()
                .tls_config(
                    TlsConfig::builder()
                        .provider(TlsProvider::NativeTls)
                        .build(),
                )
                .build()
                .new_agent()
                .get(&url)
                .header("User-Agent", USER_AGENT)
                .call()
                .context("Failed to download development pack")?;
            let mut content = vec![];
            response
                .into_body()
                .into_reader()
                .read_to_end(&mut content)
                .context("Failed to read development pack")?;
            let mut content = Cursor::new(&mut content);
            let mut zip_content = zip::read::ZipArchive::new(&mut content)
                .context("Failed to unzip development pack")?;
            let inner_name = zip_content
                .file_names()
                .next()
                .and_then(|f| f.split('/').next())
                .context("Failed to get development pack name")?;
            let devpack_path = out_dir.join(inner_name);
            let _ = std::fs::remove_dir_all(&devpack_path);
            zip_content
                .extract(&out_dir)
                .context("Failed to extract devpack to directory")?;
            Ok(devpack_path)
        }

        download(&zip_name, false)
            .or_else(|_| download(&zip_name, true))
            .map(DevelPack)
    }
Downloads a new PHP development pack, unzips it in the build script
temporary directory.
windows_build.rs