Gregwar Captcha

Generate distorted CAPTCHA images in PHP to stop bots.

Library
Composer
vv2.1.0
1,815stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
67/100Good
Development Activity44
Maintenance44
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture74
Code Quality76
Innovation62
Learning Curve82

Gregwar Captcha is a PHP library for generating CAPTCHA images that help protect forms from bots and spam. A fluent CaptchaBuilder produces a random phrase and renders it as a distorted image you can save to disk, stream to the browser, or inline as a data URI.

The builder is highly configurable — you control the phrase, fonts, colors, distortion, background, and image quality — and it pairs a PhraseBuilder for generating and validating the challenge text against user input.

What You Get

  • A fluent CaptchaBuilder for generating CAPTCHA images
  • Save-to-file, direct output, and inline data-URI rendering
  • Configurable phrase, fonts, colors, distortion, and quality
  • A PhraseBuilder for creating and validating challenge text

Common Use Cases

  • Protecting registration and contact forms from automated bots
  • Reducing comment and signup spam on PHP websites
  • Rendering inline CAPTCHA images without writing temporary files

Under The Hood

Architecture - CaptchaBuilder (implementing CaptchaBuilderInterface) holds a phrase from PhraseBuilder, then in build() uses PHP’s GD extension to create an image, draw the phrase with bundled TTF fonts, and apply distortions (wave interpolation, random lines, background noise). Output methods save(), get(), output(), and inline() encode the GD resource to JPEG. Tech Stack - PHP with the GD image extension, bundled font files, distributed via Composer under the Gregwar\Captcha namespace; tests run under PHPUnit. Code Quality - Mature and widely adopted (1.8k stars, active releases) with a small focused class set and interface abstraction; test coverage is present though modest. API Design - Very approachable: (new CaptchaBuilder)->build() yields a captcha, and chainable setters plus three output modes keep integration to a few lines.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search