imanghafoori/php-search-replace
PHP Search Replace is a command-line tool for finding and replacing strings across files in a project. Use it to perform bulk edits, refactor code, or update repetitive text safely from the terminal, making large-scale file changes faster and easier.
sed scripts or a one-off token parser every time a rename is needed, this package offers a reusable primitive for "smart" (syntax-aware) search-and-replace against PHP source. That is a build-vs-adopt call a PM can frame as: small dependency, dev-only, replaces ad-hoc scripts we keep rewriting.str_random() → Str::random()), moved namespaces, deprecated facade methods, config key changes. A tool like this turns those into a scripted, reviewable migration step rather than a multi-day manual sweep — directly affecting the "can we do the upgrade this quarter?" estimate.Consider it when:
vendor/).tools/ or migrations/ and run on a branch.require-dev), invoked in one-off scripts or CI hygiene jobs, with zero runtime footprint.Look elsewhere when:
To executives: This is a small, MIT-licensed developer tool that automates the mechanical part of framework and dependency upgrades. The business case is cycle time: rename-and-replace work that currently consumes days of senior engineer attention becomes a scripted job that runs in minutes and produces a reviewable diff. It carries no production runtime cost — it's a dev-only dependency used in migration scripts — so the risk profile is low and reversible. The caveat worth stating plainly: it's a single-maintainer, low-adoption project, so we should treat it as a tactical utility for one or two migrations rather than strategic infrastructure, and keep the scripts in-repo so we're never locked in.
To engineering: Treat this as a codemod helper, not a compiler. Proposed adoption path: (1) spike it against one real, scoped change — a helper rename or namespace move in a single package; (2) run it on a branch, diff the output, and confirm with the existing test suite plus static analysis; (3) measure false positives and missed call sites, especially dynamic references (strings, config, reflection); (4) if the diff is clean, promote the script into a tools/codemods/ directory with a short README and a "run on a branch, review the diff, require green CI" rule. Keep the invocation pinned and dev-only, exclude vendor/, and set an explicit escalation rule: the moment we need type resolution, inheritance awareness, or multi-file semantic edits, we switch to Rector rather than growing this into a homegrown refactoring engine. Budget roughly a day for the spike; the decision gate is whether one real migration completes with a diff a reviewer can trust.
How can I help you explore Laravel packages today?