symfony/polyfill-php71
Symfony polyfill backporting PHP 7.1 features—like the iterable pseudo-type—to older runtimes (PHP 5.3+). It lets libraries and frameworks use newer syntax while remaining compatible with legacy PHP installations.
Primary decision: your PHP version baseline. This package exists to answer one question — "can we keep running on PHP 7.0 for another release cycle?" It backports a narrowly scoped set of PHP 7.1 runtime features (is_iterable() and Closure::fromCallable()) so code written against a 7.1+ runtime can still execute on 7.0. If you adopt it, you are explicitly saying "PHP 7.0 remains in our support matrix," which is a roadmap and support-cost decision, not a technical one.
Build vs. buy: neither — consume. There is no product justification for writing this yourself. Symfony maintains it inside its monorepo and splits it to a standalone, MIT-licensed package. The PM-relevant framing is "zero-cost dependency hygiene," not "capability acquisition."
Dependency-tree forensics. Presence of this package in composer.lock is a lagging indicator of technical debt: it tells you some transitive dependency still declares php: >=7.0. That makes it useful as a measurement, not a feature. Track it as a canary in your runtime-modernization dashboard rather than a package you deliberately chose.
Migration sequencing (limited). It lets a library author publish one code path that works on both 7.0 and 7.1+ instead of branching on PHP_VERSION_ID. This is genuinely useful only for open-source library maintainers with unknown downstream consumers — which is not the situation for a typical product codebase.
What it does not support. Critically, a PM should understand the ceiling here: polyfills cannot backport syntax. Nullable type declarations, void, the iterable type hint, multi-catch, list() keys, and class constant visibility are all parser-level features. So this package cannot be used to justify "we'll adopt modern PHP idioms while staying on 7.0" — the answer there is a runtime upgrade or a transpiler (Rector), which is a different investment entirely. It also does nothing for the four subsequent polyfill generations (php72, php73, php74, php80) your code will eventually want.
Signals against it here. 25 stars and 0 tracked dependents reflect the fact that this is a monorepo split package, not a project with its own community — but combined with the low composite score, the honest read is that this package is effectively obsolete. PHP 7.1 itself reached end-of-life in December 2019, so a shim whose entire purpose is "be compatible with the runtime before an EOL'd runtime" is serving a vanishing population. Any framework baseline from Laravel 5.6 onward already requires PHP 7.1.3+, making this package a no-op for modern Laravel applications.
Adopt only if all of the following hold:
"php": ">=7.0.0" in composer.json for a real, named set of legacy consumers — not a hypothetical one.is_iterable() or Closure::fromCallable() and you want to avoid scattering PHP_VERSION_ID guards.Look elsewhere — or deliberately remove it — when:
class_exists/function_exists guards so the runtime cost is negligible, but the cognitive and audit cost isn't. Drop it and let the lock file get shorter.spl_object_id, array_key_first, is_countable, typed properties, etc.). Use the corresponding symfony/polyfill-phpXX — or better, raise the baseline.mbstring, intl, ctype, iconv). Those are separate, actively maintained polyfills with real value; don't let a stale dependency on this one create a blanket "polyfills are useless" conclusion.To executives: This is not a product investment — it's a two-function compatibility shim with zero customer-visible surface. It's MIT-licensed and maintained inside Symfony's monorepo, so there is no vendor or licensing risk and effectively zero cost. It doesn't unlock a feature, a market, or revenue; it only buys permission to keep supporting a runtime that has been end-of-life since 2019. The decision it actually informs is "when do we raise our minimum PHP version?" — and the right answer is to schedule that upgrade, not to adopt this package. Recommend: do not add; deprecate where present; track removal as a milestone in the platform-modernization workstream.
To engineering: Treat it as purely transitive — never require it directly in application code. Allow it through Composer if a dependency needs it, but open a removal ticket tied to the next PHP baseline bump. Before committing to any work around it, run the cheap experiment: remove it, run the full test suite and a production-like smoke test, and see if anything breaks. It usually won't. If you do need the two functions on an old runtime, use the canonical package rather than hand-rolling a shim — but document the runtime floor it implies, because that's the actual cost you're carrying. For the syntax-level modernization work this package can't cover, budget a Rector pass as a separate, explicitly scoped initiative.
How can I help you explore Laravel packages today?