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 Php83 Laravel Package

symfony/polyfill-php83

Symfony polyfill for PHP 8.3 backports PHP 8.3 features to older PHP versions, including json_validate, the Override attribute, mb_str_pad, str_increment/str_decrement, Date* exceptions, LDAP helpers, and stream_context_set_options.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Runtime roadmap / platform version floor. The core PM decision here is "when do we upgrade PHP?" This package decouples writing PHP 8.3-era code from running PHP 8.3. It buys 12–24 months on a PHP 7.4–8.2 baseline (Laravel 8/9/10) without forcing a platform migration sprint onto the roadmap. Frame it as buying time, not as a feature.
  • Build vs. buy for utility shims. Teams routinely hand-roll json_validate, string-increment helpers, and multibyte padding logic. This replaces bespoke, undertested helpers with a Symfony-maintained implementation that already has years of edge-case fixes (v1.43 closed json_validate, str_increment/str_decrement, and mb_str_pad defects). The decision is "adopt and delete our versions," and the PM should explicitly budget the deletion work — otherwise you carry both.
  • Code-standard decisions (what new code is allowed to use). The polyfill is what makes a style-guide policy enforceable: approve json_validate for API payload gating, str_increment/str_decrement for version counters and document/invoice numbering, mb_str_pad for multibyte-safe fixed-width exports, and the Override attribute for IDE/refactor safety. Without it, those are "someday" items; with it, they're standards.
  • Migration-friction reduction. Because the same symbols work before and after the runtime upgrade, the eventual PHP 8.3 migration becomes a dependency bump rather than a code rewrite. That directly shrinks the estimate of a future roadmap item — a lever worth naming in planning.
  • Dependency lifecycle as a roadmap item. Retirement is a real decision: once PHP 8.3+ is the baseline, the polyfill is a no-op and should be removed. PMs should own the exit criterion and tie it to the platform-version milestone so it doesn't linger for years.
  • Where it does not help: it is not a differentiator, not a security control, and not a reason to delay the PHP upgrade indefinitely. Treat it as cost avoidance on the platform track, not as a line item on a feature roadmap.

When to Consider This Package

Adopt when:

  • The application's PHP floor is below 8.3 and there is concrete, planned use of at least one backported feature (most commonly json_validate in API controllers or str_increment for versioning). Adoption without intended use is pure dependency surface with no return.
  • The stack is Composer-managed Laravel/Symfony — it slots into the existing symfony/polyfill-* family already pulled in transitively, so marginal risk is near zero.
  • You have a defined exit criterion (PHP 8.3+ baseline) and an owner for routine dependency updates.
  • You are willing to pin a floor of ^1.43 rather than a floating range, so the corrected edge cases are guaranteed across environments.

Look elsewhere or skip when:

  • You are already on PHP 8.3+. The package is a no-op — remove it rather than add it.
  • The codebase is non-Composer or non-Symfony-aligned (e.g., WordPress plugins, mixed-framework monoliths) where duplicate function_exists guards from other dependencies are a live conflict risk. Audit before rollout; this is the single most common integration problem.
  • You need exactly one function. A five-line guarded helper is cheaper than a dependency you have to track, test, and later remove.
  • You're below PHP 8.0 — the Override attribute isn't usable there, so scope it out of the value case.
  • Correctness is bit-exactness-critical. Polyfills target parity, not guaranteed identical behavior with native 8.3; if a code path can't tolerate that, defer the feature until the runtime is upgraded.
  • Note the practical reality: this is almost certainly already installed transitively. The real decision is usually "pin a floor and standardize usage," not "adopt a new dependency." Don't spend a decision meeting on it — spend one on whether you'll delete the hand-rolled replacements.

How to Pitch It (Stakeholders)

For executives — one paragraph: We want to use a handful of modern PHP language features that make our API validation and record-versioning code simpler and less error-prone, but our servers run an older PHP version than those features require. This package — a free, MIT-licensed component maintained by the Symfony team and already part of our dependency tree indirectly — lets us write that modern code today without scheduling a PHP platform upgrade. The ask is not a project: it's a version pin and a small amount of cleanup to remove our own hand-written equivalents. The benefit is that we defer a costly platform migration by a year or more, and we retire custom utility code that our team currently maintains and tests. The tradeoff is one more dependency to track, with a clear plan to remove it once we're on PHP 8.3.

For engineering — the operating agreement:

  • Pin ^1.43 (not a floating range) so the recent edge-case fixes are guaranteed everywhere.
  • Phase adoption: non-critical exception classes first, then core logic (json_validate in request validation, str_increment in versioned models), then the Override attribute for IDE support.
  • Wrap polyfilled calls in thin app-level helpers and keep function_exists guards for portability — this is also the conflict mitigation against third-party packages shipping the same functions.
  • Keep differential tests running across the PHP 7.4–8.2 CI matrix against native 8.3 behavior, specifically for large/leading-zero numeric strings and deeply nested or non-UTF-8 JSON.
  • Delete the existing hand-rolled shims in the same cycle as adoption, or you'll maintain two implementations.
  • Record the version floor and the removal criterion in UPGRADING.md; treat polyfill patch releases as routine maintenance, not as projects.
  • Verify whether anything in the stack touches tokenizer, ODBC, or INI parsing — the recent fixes there are irrelevant to a standard Laravel web stack, but confirm rather than assume.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource