Weave Code
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 Php73

Polyfill Php73 Laravel Package

symfony/polyfill-php73

Symfony Polyfill for PHP 7.3: provides missing core features on older PHP versions, including array_key_first/last, hrtime, is_countable, and JsonException. Part of Symfony’s polyfill set for forward-compatible apps.

View on GitHub
Deep Wiki
Context7

Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions

Frequently asked questions about Polyfill Php73
How do I use symfony/polyfill-php73 in a Laravel project?
Install it via Composer with `composer require symfony/polyfill-php73`. No additional Laravel configuration is needed—it autoloads polyfills conditionally based on your PHP version. Use the polyfilled functions (e.g., `array_key_first()`) just like native PHP 7.3+ methods.
What PHP versions does symfony/polyfill-php73 support?
It works on PHP 5.3 through 7.2, providing the missing PHP 7.3 features. On PHP 7.3+, the polyfills are silently ignored, ensuring zero runtime overhead. Laravel’s minimum PHP version (5.6+) is fully compatible.
Will this package conflict with Laravel’s existing symfony/polyfill?
No, it integrates seamlessly. If Laravel already includes `symfony/polyfill`, this package may be redundant—check your `vendor/symfony/polyfill` for existing PHP 7.3 polyfills. Use `composer show symfony/polyfill` to verify.
Does symfony/polyfill-php73 add performance overhead?
Minimal. Polyfills are lazy-loaded and add negligible overhead (typically <0.1ms). Benchmark critical paths (e.g., `hrtime()` in timing-sensitive code) in a staging environment to confirm.
Can I use JsonException from this polyfill in Laravel’s API responses?
Yes. The `JsonException` polyfill works identically to PHP 7.3’s native class. Use it for robust JSON error handling in Laravel’s HTTP responses or API contracts without requiring PHP 7.3.
How do I verify this is the official Symfony package and not a malicious fork?
Check the package source via `composer show symfony/polyfill-php73` and confirm it points to Symfony’s official GitHub repository. Pin the version (e.g., `1.37.0`) in `composer.json` and validate the source hash against Symfony’s repository.
What if my Laravel app already manually implements array_key_first()?
Avoid conflicts by auditing your codebase for custom polyfills/shims. If duplicates exist, refactor to use this package’s version or disable the polyfill via Composer’s `replace` directive in `composer.json`.
Is this package safe for production use in Laravel?
Yes, it’s widely used in Symfony and Laravel ecosystems. Test critical paths (e.g., Eloquent collections with `array_key_first()`) in staging. The MIT license ensures no legal risks, and Symfony’s maintenance guarantees stability.
What happens if I upgrade to PHP 8.x in the future?
Polyfills are automatically ignored on PHP 7.3+. If you upgrade to PHP 8.x, remove this package via `composer remove symfony/polyfill-php73`—native implementations will replace the polyfills seamlessly.
Are there alternatives to symfony/pphp73 for Laravel?
For PHP 7.3 features, alternatives are limited. Other polyfill suites (e.g., `ramsey/array_functions`) may cover some functions but lack Symfony’s ecosystem integration. This package is the most Laravel-friendly option for PHP 7.3 compatibility.
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.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope