feat: default to CurlPost when cURL is available#595
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #253 and potentially #411 by defaulting to the more reliable
CurlPostrequest method whenever the PHPcurlextension is available. If cURL is not installed, it falls back to the originalPost(file_get_contents) method, maintaining backwards compatibility.