Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Polyfill Php71 Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

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.

When to Consider This Package

Adopt only if all of the following hold:

  • You (or a library you maintain) must declare "php": ">=7.0.0" in composer.json for a real, named set of legacy consumers — not a hypothetical one.
  • Your code genuinely calls is_iterable() or Closure::fromCallable() and you want to avoid scattering PHP_VERSION_ID guards.
  • You have no ability to pin those specific call sites to an older idiom instead.
  • The package arrives or is added as a transitive-only dependency, and your job is to decide whether to allow, block, or pin it — a Composer policy question, not an architecture question.

Look elsewhere — or deliberately remove it — when:

  • Every environment is PHP 7.1+. It becomes dead weight. Symfony's bootstrap uses 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.
  • You are on Laravel 5.6 or later, or any framework with a 7.1+ floor. It cannot be doing anything for you. Remove it.
  • You need behavior from 7.2, 7.3, 7.4, or 8.x (spl_object_id, array_key_first, is_countable, typed properties, etc.). Use the corresponding symfony/polyfill-phpXX — or better, raise the baseline.
  • You need syntax-level features. No polyfill will help; scope a runtime upgrade or a Rector-driven refactor.
  • You need broad compatibility shims (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.
  • Security or compliance review is in scope. Supporting EOL runtimes is the larger finding; this package is a symptom, and fixing it in isolation addresses nothing.

How to Pitch It (Stakeholders)

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle