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

symfony/polyfill-php81

Symfony polyfill providing PHP 8.1 features on older PHP versions: array_is_list, enum_exists, ReturnTypeWillChange, MYSQLI_REFRESH_REPLICA, and CURLStringFile.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Incremental modernization without forced PHP upgrades: Enables Laravel/PHP 7.4–8.0 applications to adopt selected PHP 8.1 features (e.g., array_is_list, enum_exists) while deferring costly runtime upgrades. This supports roadmap decisions to ship value now and migrate infrastructure on a planned timeline.
  • Feature roadmap acceleration: Unblocks product work that depends on PHP 8.1 capabilities—such as enum-based domain models (OrderStatus, PaymentStatus) or cleaner validation logic—without waiting for a platform upgrade. Product can prioritize user-facing features over infrastructure churn.
  • Build vs. buy: Avoids custom polyfill maintenance for core PHP functions. Symfony’s implementation is MIT-licensed, widely used in the PHP ecosystem, and maintained through Composer. This is a low-effort, low-risk dependency compared with in-house compatibility shims.
  • Use cases worth evaluating:
    • Validation/type safety: Replace manual sequential-array checks with array_is_list() in API request validation and data pipelines.
    • Domain modeling: Introduce enums for roles, statuses, and workflow states on PHP 7.4–8.0.
    • Third-party compatibility: Satisfy SDKs or packages that expect PHP 8.1 features while maintaining older Laravel branches.
    • Migration preparation: Use ReturnTypeWillChange and other polyfilled features to reduce friction during future PHP upgrades.

When to Consider This Package

  • Adopt when:
    • The application is on Laravel 8.x–9.x / PHP 7.4–8.0 and needs specific PHP 8.1 features.
    • There is a PHP upgrade roadmap, and this package serves as a temporary bridge rather than a permanent substitute.
    • New product functionality is blocked by missing PHP 8.1 capabilities, especially enums or array_is_list.
    • The team wants a Composer-installable, MIT-licensed solution instead of custom compatibility code.
    • A third-party dependency requires PHP 8.1 behavior but the production environment cannot yet upgrade.
  • Look elsewhere or avoid when:
    • The platform already runs PHP 8.1+; native functions are preferable.
    • Only a tiny fraction of the codebase would use polyfilled features, making the added dependency hard to justify.
    • Performance-critical paths cannot absorb even small polyfill overhead; benchmark before committing.
    • The organization has no plan to address PHP 7.4 end-of-life; this package does not provide security patches for the runtime.
    • The stack is not Laravel/Symfony and integration or maintenance overhead would outweigh benefits.
    • The project is short-lived and dependency cleanup would create unnecessary churn.

How to Pitch It (Stakeholders)

For executives: This is a low-risk bridge that lets us use selected PHP 8.1 features—such as enums and stricter array validation—on our current Laravel/PHP platform. It is MIT-licensed, Symfony-maintained, and installs through Composer with no application rewrite. It helps us ship roadmap features sooner, avoid custom compatibility code, and defer infrastructure upgrades until planned. The tradeoff is a temporary dependency and minor per-call overhead; it is not a replacement for eventually upgrading PHP, especially given PHP 7.4’s end-of-life security risk.

For engineering: symfony/polyfill-php81 provides namespaced, opt-in implementations of PHP 8.1 features for PHP 7.4–8.0 environments. Adoption is simple: composer require symfony/polyfill-php81, then use the polyfilled functions or constants where needed. It requires no Laravel service provider or configuration and avoids conflicts with native PHP 8.1+ behavior. Use it for targeted cases—validation with array_is_list(), enums in domain models, or third-party compatibility—not as a blanket modernization strategy. Add tests for edge cases, benchmark critical paths, document the PHP-version constraint, and plan to remove the dependency once the application runs on PHP 8.1+.

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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator