Show HN: GNU Grep as a PHP Extension

PHP gets built‑in super search — cue a license brawl

TLDR: A new PHP extension embeds GNU grep for fast searching, but it ships under the GPL, a share‑alike license. Commenters fixated on licensing risks over features, with calls for an MIT license, clearer benchmarks, and a friendlier comparison chart, raising adoption questions for closed‑source teams.

Show HN drop: someone wired the famous GNU grep search tool straight into PHP as a native plugin — no shell tricks, just fast, in‑process searching. It loads as a module and exposes friendly functions, with lots of familiar grep flags already working. Sounds neat, right? The community immediately smashed that Like button… on the license drama. The project ships under GPLv3, a share‑alike license that can force code sharing when distributing software, and that set off alarms. One top commenter called the choice “weird” and insisted it’s begging to be MIT (MIT license is corporate‑friendly), warning that companies will steer clear. Others begged for a comparison chart and real benchmarks before they consider swapping their trusty command line for a PHP module. Meanwhile, the author’s docs plainly say the GPL choice is intentional — which only poured more gasoline on the thread. Jokes flew about “grepping production logs from PHP at 3 a.m.” and “WordPress admin suddenly becoming a forensic lab,” while memes about “license police” patrolling PRs got plenty of upvotes. In short: cool tech, spicy licensing, and a chorus demanding charts, numbers, and maybe a lawyer. The feature list impressed; the license brawl stole the show.

Key Points

  • A native PHP extension embeds GNU grep internals, implemented in C and built with phpize as grep.so.
  • Current features include fixed-string, basic, and extended regex matching with PHP-style shorthands and a broad set of grep options via GNUGrep\Engine::run().
  • The project vendors a specific upstream GNU grep commit and acknowledges GPLv3-or-later licensing implications for distribution.
  • Build and test instructions are provided, including PHPT-based tests and manual loading to query version information.
  • A comparison harness validates correctness and performance against upstream GNU grep; PCRE mode and additional CLI features are planned.

Hottest takes

“It’s really asking to be MIT” — cynicalsecurity
“GPL‑v3‑or‑later is not appropriate for proprietary/closed‑source” — cynicalsecurity
“The README is lacking a nicely looking comparison chart” — cynicalsecurity
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.