Skip to content

v2.0.0

Latest

Choose a tag to compare

@HelgeSverre HelgeSverre released this 15 Oct 09:04
454cbb2

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.
  • Types is now a string-backed enum. Use check(Types::EMAIL, $email), Types::IP, or Types::USERNAME instead of passing a string. The convenience methods checkEmail(), checkIP(), and checkUsername() remain available.
  • Public methods and properties have strict types.
  • Failures throw ApiCheckException, ApiKeyMissingException, or SubmissionFailedException. 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.0

Thanks 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.

Full changelog