recaptcha
AGENTS.md3.6k starsChanged 2 months agoBSD-3-ClauseView on GitHub
This file provides authoritative context, architectural invariants, branching policies, and verification requirements for AI coding agents and maintainers working on google/recaptcha.
Trending
Quiet since June.thin dataabout the whole repository
Who's talking about google/recaptcha
- DethAriel/ng-recaptcha“Upgrade to Angular 17?”GitHub · Nov 8, 2023 · 24 reactions
- A Hacker News story“Fuck reCaptcha (2018)”Hacker News · Feb 14, 2019 · 22 points
- DethAriel/ng-recaptcha“Upgrade to Angular 14”GitHub · Jun 6, 2022 · 7 reactions
- @rowan.fyi“Released 1.4.2 of the #reCAPTCHA #PHP client library with support for PHP 8.4 & 8.5. With 88 million …”Bluesky · Mar 21, 2026 · 4 likes
- DethAriel/ng-recaptcha“Support for Angular 13”GitHub · Nov 6, 2021 · 4 reactions
The biggest 5 of 13 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 13
Talked about on GitHub, Hacker News and Bluesky (13 times).
On GitHub · 9
- Nov 8, 2023Upgrade to Angular 17? — DethAriel/ng-recaptcha24 reactions · 6 comments
- Jun 6, 2022Upgrade to Angular 14 — DethAriel/ng-recaptcha7 reactions · 5 comments
- Nov 6, 2021Support for Angular 13 — DethAriel/ng-recaptcha4 reactions · 7 comments
- Apr 27, 2021Destroy recaptchaV3 manually — DethAriel/ng-recaptcha3 reactions · 1 comment
- Jun 17, 2026.reset() Doesn't work on reset id 0 — LakhveerChahal/ng-recaptcha-22 reactions · 1 comment
4 more on GitHub
- Jan 18, 2026Feature request: Support Signal Forms — LakhveerChahal/ng-recaptcha-22 reactions · 1 comment
- Sep 23, 2025Support on Angular v20 — DethAriel/ng-recaptcha2 reactions · 3 comments
- Oct 27, 2024Recaptcha v3 loading the script multiple times. — elementor/elementor2 reactions · 2 comments
- Jun 6, 2023There is no way to know if a user pressed escape on the puzzle — DethAriel/ng-recaptcha2 reactions · 1 comment
On Hacker News · 2
- Feb 14, 2019Fuck reCaptcha (2018)22 points · 9 comments
- May 5, 2016Why Isn't Google's ReCaptcha 'Responsive'?1 point
On Bluesky · 2
- Mar 21, 2026Released 1.4.2 of the #reCAPTCHA #PHP client library with support for PHP 8.4 & 8.5. With 88 million installs so far, I think it's fair to… — @rowan.fyi4 likes and reposts
- Jun 26, 2025Released v1.3.1 of the #PHP client for #reCAPTCHA. A minor bump that removes some deprecation warnings with PHP 8.4. I appreciate the pull… — @rowan.fyi2 likes and reposts
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
13 rules. About 0 are common, 1 is distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
All development, CI, test, documentation, and agent configuration files MUST be listed with export-ignore in .gitattributes so Composer …
- Very specific: line 27
Every push and pull request on main runs roave/backward-compatibility-check against the latest tagged release in .github/workflows/php.yml.
- Very specific: line 36
When preparing a new release (X.Y.Z):
- Very specific: line 37
Update ReCaptcha::VERSION (public const VERSION = 'php_X.Y.Z';) in src/ReCaptcha/ReCaptcha.php.
- Very specific: line 38
If starting a new minor/major series, update extra.branch-alias.dev-main in composer.json.
- Very specific: line 39
Run all quality gates (composer validate --strict, composer audit, composer run lint, composer run phpstan, composer run test).
- Very specific: line 65
TLS Verification: Always keep peer verification enabled (CURLOPT_SSL_VERIFYPEER => true in CurlPost.
- Very specific: line 66
Timeouts: All 3 transports enforce a 60-second timeout (CURLOPT_TIMEOUT => 60, CURLOPT_CONNECTTIMEOUT => 60, stream timeout => 60, …
- Very specific: line 68
Do not call curl_close() in CurlPost (curl_close() is a no-op since PHP 8.0 and deprecated in PHP 8.5.
- Very specific: line 69
Always call fclose($handle) on every exit path in SocketPost once fsockopen() returns a valid handle (including when stream_set_timeout() …
- Very specific: line 79
Every test class MUST declare explicit #[CoversClass(...)] and #[UsesClass(...)] PHPUnit attributes (never @coversNothing).
- Very specific: line 82
Always reset static mock state in setUp() or tearDown().
- Distinctive: line 89
Before creating a commit or opening a pull request, run all five checks locally and ensure zero errors or warnings:
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — Contributor & Maintainer Guide for AI Agents
This file provides authoritative context, architectural invariants, branching policies, and verification requirements for AI coding agents and maintainers working on google/recaptcha.
1. Project Identity & Core Constraints
- Purpose: Official PHP client library for verifying Google reCAPTCHA (
v2Checkbox,v2Invisible, andv3) tokens against thesiteverifyendpoint (https://www.google.com/recaptcha/api/siteverify). - Scope Boundary: This library targets the standard reCAPTCHA
siteverifyAPI. Projects using Google Cloud reCAPTCHA Enterprise should usegoogle/cloud-recaptcha-enterprise. - Zero Runtime Dependencies:
composer.jsonrequireMUST only specify"php": ">=8.4"(and optional PHP extensions insuggestif ever needed). Never add third-party runtime packages torequire.- The library MUST work both via Composer's PSR-4 autoloader (
vendor/autoload.php) and via the standalone autoloader (src/autoload.php) for non-Composer installations.
- Distribution Cleanliness:
- All development, CI, test, documentation, and agent configuration files MUST be listed with
export-ignorein.gitattributesso Composer--prefer-distarchives contain only runtime library files (src/,composer.json,LICENSE,README.md).
- All development, CI, test, documentation, and agent configuration files MUST be listed with
2. Branching Model & Semantic Versioning (SemVer)
Active Branch
| Branch | Series | PHP Constraint | Type System & Mutability Contract |
main | 2.x (2.1.x-dev) | >=8.4 | declare(strict_types=1) in all files, strict scalar/return type hints, readonly properties on RequestParameters and Response. |
Backward Compatibility Enforcement (roave/backward-compatibility-check)
- Every push and pull request on
mainrunsroave/backward-compatibility-checkagainst the latest tagged release in.github/workflows/php.yml. - Allowed changes in minor/patch releases (
2.1.x,2.x.0):- Updating the value of
ReCaptcha\ReCaptcha::VERSION(explicitly allowlisted in.roave-backward-compatibility-check.xml). - Internal implementation improvements that do not alter class hierarchies, public/protected method signatures, parameter types, return types, property types/visibility, or constant values.
- Adding new optional parameters with default values or new public methods/constants (minor release
2.x.0).
- Updating the value of
- Breaking changes (require
3.0.0):- Narrowing parameter types, widening return types, changing
readonlymodifiers, removing or renaming public/protected methods/properties/constants, or adding required methods toReCaptcha\RequestMethod.
- Narrowing parameter types, widening return types, changing
Release Checklist
When preparing a new release (X.Y.Z):
- Update
ReCaptcha::VERSION(public const VERSION = 'php_X.Y.Z';) insrc/ReCaptcha/ReCaptcha.php. - If starting a new minor/major series, update
extra.branch-alias.dev-mainincomposer.json. - Run all quality gates (
composer validate --strict,composer audit,composer run lint,composer run phpstan,composer run test). - Tag
X.Y.Zon the target branch and publish structured GitHub Release notes (Overview,Breaking Changesif major,Bug Fixes/What's Changed,Compatibility & Upgrade Guide, andFull Changelogcompare link).
3. Architecture & Security Invariants
src/
├── autoload.php # Standalone PSR-4-equivalent autoloader
└── ReCaptcha/
├── ReCaptcha.php # Main client & fluent verification builder
├── RequestMethod.php # Transport interface: submit(RequestParameters): string
├── RequestParameters.php # Immutable (readonly) request payload value object
├── Response.php # Immutable (readonly) parsed siteverify response DTO
└── RequestMethod/
├── CurlPost.php # Default transport when ext-curl is available
├── Post.php # Fallback transport using file_get_contents() + stream context
└── SocketPost.php # Fallback transport using fsockopen() TLS socketsKey Invariants
- No Exceptions on Network or Validation Failures:
ReCaptcha::__construct()throws\RuntimeExceptionif$secretis empty (''), and PHP throws\TypeErrorif invalid types are passed understrict_types=1.ReCaptcha::verify()andRequestMethod::submit()never throw on network errors, malformed JSON, or failed verification checks. Instead, transports return synthetic JSON error payloads (E_CONNECTION_FAILED,E_BAD_RESPONSE),Response::fromJson()returnsE_INVALID_JSONorE_UNKNOWN_ERROR, andReCaptcha::verify()returns aResponsewithisSuccess() === falseand populatedgetErrorCodes().
- Transport Security & Resource Management:
- TLS Verification: Always keep peer verification enabled (
CURLOPT_SSL_VERIFYPEER => trueinCurlPost;verify_peer => trueandverify_peer_name => trueinPost;ssl://inSocketPost). - Timeouts: All 3 transports enforce a 60-second timeout (
CURLOPT_TIMEOUT => 60,CURLOPT_CONNECTTIMEOUT => 60, streamtimeout => 60,fsockopen+stream_set_timeout60s). - Resource Cleanup:
- Do not call
curl_close()inCurlPost(curl_close()is a no-op since PHP 8.0 and deprecated in PHP 8.5;CurlHandlecloses automatically when out of scope). - Always call
fclose($handle)on every exit path inSocketPostoncefsockopen()returns a valid handle (including whenstream_set_timeout()fails).
- Do not call
- TLS Verification: Always keep peer verification enabled (
4. Testing Architecture & Conventions
- 100% Code Coverage:
- The test suite in
tests/ReCaptcha/maintains 100% line, method, and class coverage acrosssrc/ReCaptcha/. Any new code or branch insrc/MUST have corresponding unit tests maintaining 100% coverage.
- The test suite in
- Strict PHPUnit 13 Metadata:
phpunit.xml.distenablesbeStrictAboutCoverageMetadata="true",beStrictAboutOutputDuringTests="true", andfailOn*(Warning,Risky,Deprecation,Notice,EmptyTestSuite).- Every test class MUST declare explicit
#[CoversClass(...)]and#[UsesClass(...)]PHPUnit attributes (never@coversNothing).
- Namespace-Scoped Function Mocking:
- Because
CurlPost,Post,SocketPost, andReCaptchacall unqualified PHP built-in functions (function_exists,curl_init,curl_setopt_array,curl_exec,file_get_contents,fsockopen,fwrite,stream_get_contents,stream_set_timeout,fclose) from within theReCaptchaorReCaptcha\RequestMethodnamespaces, tests intercept these calls by defining namespace-scoped functions backed by static state classes (GlobalState,CurlPostGlobalState,PostTest::$assert,SocketPostGlobalState). - Always reset static mock state in
setUp()ortearDown(). - In
src/, do not prefix those mocked built-in functions with a leading backslash (\curl_exec,\file_get_contents, etc.), as doing so bypasses namespace lookup and breaks the unit test mocks.
- Because
5. Mandatory Quality Gates
Before creating a commit or opening a pull request, run all five checks locally and ensure zero errors or warnings:
# 1. Validate composer.json and composer.lock
composer validate --strict
# 2. Check for known security vulnerabilities in dependencies
composer audit
# 3. Check code formatting and strict_types enforcement (PHP-CS-Fixer)
composer run lint
# (Use `composer run lint-fix` to automatically format files)
# 4. Run static analysis at max level + strict rules + PHPUnit rules (PHPStan)
composer run phpstan
# 5. Run unit tests with Xdebug coverage and strict PHPUnit 13 checks
composer run testTo manually test the interactive example pages locally:
composer run serve-examples
# Starts PHP built-in server at http://localhost:8080 serving examples/Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

