Skip to content

v4.0.0 — FriendlyCaptcha v2 API (fixes from PR #10)#13

Open
ossycodes wants to merge 3 commits into
masterfrom
v2-api-fixes
Open

v4.0.0 — FriendlyCaptcha v2 API (fixes from PR #10)#13
ossycodes wants to merge 3 commits into
masterfrom
v2-api-fixes

Conversation

@ossycodes

Copy link
Copy Markdown
Owner

Summary

This PR applies all the fixes identified during review of #10 by @KRMM2025 and prepares the codebase for a v4.0.0 major release. All credit for the v2 API migration goes to @KRMM2025 — this branch just addresses the bugs before merging.

Changes from #10:

# Issue Fix
1 verifyResponse() returned false (bool) → fatal TypeError in Rules::passes() Always returns $this; sets isSuccess = false on empty input
2 bootLang() overwrote bootMacro()'s Rule::macroRule::friendlycaptcha() crashed Removed bootLang(); translations loaded directly in boot()
3 $error declared but $errors used → dynamic property, getErrors() returned null Renamed declared property to $errors
4 Illuminate\Contracts\Validation\Rule removed in Laravel 12 Replaced with Illuminate\Contracts\Validation\ValidationRule + validate()
5 form_params sends form-encoded; v2 API expects JSON Switched to json key in Guzzle request
6 @test annotations removed in PHPUnit 11 → no tests found Renamed methods with test_ prefix
7 SDK version inconsistency (@0.1.36 in code, @0.2.0 in CHANGELOG) Aligned all files to @0.2.0
8 Translations never actually registered Handled by fix #2

Test plan

  • CI passes across PHP 8.1–8.4 × Laravel 10–13
  • Rule::friendlycaptcha() returns a rule instance
  • Empty captcha submission returns validation error, not 500
  • Translations load correctly via friendlycaptcha::validation.*

@KRMM2025 — could you review this and confirm the v2 API behaviour looks correct from your testing? Happy to adjust anything.

🤖 Generated with Claude Code

KRMM2025 and others added 3 commits January 30, 2026 10:20
- Fix: verifyResponse() now always returns $this instead of false/bool,
  preventing fatal TypeError when captcha field is missing
- Fix: rename $error to $errors to match usage throughout the class
- Fix: sendRequestVerify() uses json instead of form_params for v2 JSON API
- Fix: SDK version aligned to @0.2.0 across all files
- Fix: bootLang() removed — translations loaded directly in boot() instead
  of overwriting the Rule macro registered by bootMacro()
- Fix: Rules/FriendlyCaptcha now implements ValidationRule (Laravel 10+)
  instead of the removed Illuminate\Contracts\Validation\Rule interface
- Fix: test methods renamed with test_ prefix (PHPUnit 11 removed @test)
- Fix: CHANGELOG version corrected to 4.0.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants