{
    "version": "3.5.1-85",
    "description": "An extension for PHP to assist with debugging and development. (Non Thread Safe)",
    "homepage": "https://xdebug.org/",
    "license": {
        "identifier": "Xdebug-1.03",
        "url": "https://xdebug.org/license"
    },
    "notes": [
        "Xdebug is already enabled if PHP (Non Thread Safe) was installed through scoop!",
        "Otherwise add '$dir\\php_xdebug.dll' to your php.ini"
    ],
    "architecture": {
        "64bit": {
            "url": "https://xdebug.org/files/php_xdebug-3.5.1-8.5-nts-vs17-x86_64.dll#/php_xdebug.dll",
            "hash": "8cddafd5326a97ed2b0321cd0529a76178238fb628e62c646f299ab4a1357e36"
        }
    },
    "post_install": [
        "$ini = \"zend_extension=$dir\\php_xdebug.dll`n[xdebug]`nxdebug.mode=debug`nxdebug.start_with_request=yes`nxdebug.discover_client_host=true\"",
        "if (installed php-nts $true) {",
        "    $ini_path = \"$(persistdir php-nts $true)\\cli\\conf.d\\xdebug.ini\"",
        "} elseif (installed php-nts $false) {",
        "    $ini_path = \"$(persistdir php-nts)\\cli\\conf.d\\xdebug.ini\"",
        "} else {",
        "    Write-Host -f Yellow \"`nPHP (Non Thread Safe) was not installed through scoop, you have to activate php_xdebug.dll manually! Add the following:`n\"",
        "    Write-Host -f Cyan \"$ini`n\"",
        "    Write-Host -f Yellow \"to your php.ini file\"",
        "}",
        "if ($ini_path) {",
        "    if (Test-Path $ini_path) {",
        "        Write-Output \"`nNo XDebug config was added, as xdebug.ini already exists in $ini_path\"",
        "    } else {",
        "        Write-Output \"`nEnabling extension $ini_path\"",
        "        Add-Content -Value $ini -Path $ini_path",
        "    }",
        "}"
    ],
    "checkver": {
        "url": "https://xdebug.org/download/historical",
        "script": [
            "$xdebug_regex = 'php_xdebug(?=[^'']+nts)-(?<prefix>[\\d.]+)-(?<suffix>[\\d.]+)(?<=\\d)[^'']+dll'",
            "$latest_xdebug = [regex]::Matches($page, $xdebug_regex) | ForEach-Object {",
            "    [pscustomobject]@{",
            "        FileName = $_.Value",
            "        XdebugVersion = [version]$_.Groups['prefix'].Value",
            "        PHPVersion = [version]$_.Groups['suffix'].Value",
            "    }",
            "} | Sort-Object XdebugVersion, PHPVersion -Descending | Select-Object -First 1",
            "$version_prefix = $latest_xdebug.XdebugVersion.ToString()",
            "$version_suffix = $latest_xdebug.PHPVersion.ToString().Split('.')[0..1] -join ''",
            "Write-Output \"$version_prefix-$version_suffix / $($latest_xdebug.FileName)\""
        ],
        "regex": "([\\d.-]+) / (?<name>.+)"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://xdebug.org/files/$matchName#/php_xdebug.dll",
                "hash": {
                    "url": "https://xdebug.org/download/historical",
                    "regex": "\"SHA256:&nbsp;$sha256\" href='/files/$basename'"
                }
            }
        }
    }
}
