Skip to content

feat: default to CurlPost when cURL is available#595

Merged
rowan-m merged 3 commits intomainfrom
feat-curl-default
Mar 20, 2026
Merged

feat: default to CurlPost when cURL is available#595
rowan-m merged 3 commits intomainfrom
feat-curl-default

Conversation

@rowan-m
Copy link
Contributor

@rowan-m rowan-m commented Mar 20, 2026

Resolves #253 and potentially #411 by defaulting to the more reliable CurlPost request method whenever the PHP curl extension is available. If cURL is not installed, it falls back to the original Post (file_get_contents) method, maintaining backwards compatibility.

rowan-m added 3 commits March 20, 2026 13:06
Updates the `ReCaptcha` constructor to automatically use `RequestMethod\CurlPost` if the cURL extension is installed (`function_exists('curl_version')`) and the user has not explicitly provided a request method. This provides better reliability out of the box while gracefully falling back to `file_get_contents()` via `RequestMethod\Post` when cURL is not available.
Moves the documentation about alternate request methods from ARCHITECTURE.md to README.md and updates it to reflect the new default behavior of attempting to use cURL.
Adds a note about the change in the default request method as of 1.4.2 and provides an example of how to maintain the previous behavior by manually injecting RequestMethod\Post.
@rowan-m rowan-m merged commit 0233b21 into main Mar 20, 2026
3 checks passed
@rowan-m rowan-m deleted the feat-curl-default branch March 20, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion to use CURL as the default request method.

1 participant