Repository navigation
SpamProtection 2.0.0 modernizes the StopForumSpam client for PHP 8.1 and later.
Breaking changes
- Requires PHP 8.1+, ext-curl, and ext-json.
Typesis now a string-backed enum. Usecheck(Types::EMAIL, $email),Types::IP, orTypes::USERNAMEinstead of passing a string. The convenience methodscheckEmail(),checkIP(), andcheckUsername()remain available.- Public methods and properties have strict types.
- Failures throw
ApiCheckException,ApiKeyMissingException, orSubmissionFailedException. API rejections and malformed spam scores throw instead of being treated as clean results.
Improvements
- Descriptive API errors with underlying transport and JSON exceptions preserved.
- HTTPS report submission with JSON responses and compatibility with the original HTML success response.
- Bounded HTTP requests, HTTP status handling, and API-key redaction in returned API errors.
- Composer version and release time are derived from Git instead of hardcoded values.
- Deterministic tests, separate live smoke tests, and CI on PHP 8.1–8.5.
- Patched PHPUnit 10 and PHPStan 2 for development; development files excluded from distribution archives.
Install
composer require helgesverre/spamprotection:^2.0Thanks to @MekDrop (Raimondas Rimkevičius) for the PHP modernization, Composer fix, and custom exceptions in #7, #8, and #9. Original commits are preserved in the release history.
Validation: 54 deterministic tests / 127 assertions passed locally on each PHP version from 8.1 through 8.5; 3 live read-only API tests, static analysis, formatting, Composer validation, and dependency audit passed.