symfony/polyfill-php81
Symfony Polyfill for PHP 8.1 features on older runtimes. Adds array_is_list, enum_exists, MYSQLI_REFRESH_REPLICA, ReturnTypeWillChange, and CURLStringFile (PHP 7.4+). Drop-in Composer dependency for wider compatibility.
array_is_list, enum_exists) in Laravel applications running on PHP 7.4–8.0, delaying costly infrastructure upgrades while reducing technical debt. Aligns with roadmaps for incremental modernization without forcing a full version leap.array_is_list in API request validation layers or use enums for UserRole/OrderStatus before upgrading PHP.array_keys($arr) === range(0, count($arr)-1)) with array_is_list() for cleaner, more performant code in Laravel’s validation pipelines (e.g., Illuminate\Validation).class PaymentStatus extends Enum) in PHP 7.4–8.0 environments, future-proofing code for PHP 8.1+ migrations.MYSQLI_REFRESH_REPLICA for MySQL replication tools or CURLStringFile for file uploads in legacy Laravel branches (e.g., Illuminate\Http\UploadedFile).ReturnTypeWillChange to annotate internal methods during refactoring, preparing for PHP 8.1+ migrations while maintaining backward compatibility.array_is_list) or enum support but lacking PHP 8.1 infrastructure.For Executives:
*"This package lets us use PHP 8.1 features—like stricter data validation (array_is_list) or enums—today, even on older servers. It’s a low-risk way to modernize our Laravel codebase incrementally, reducing upgrade costs and future-proofing our stack. Used by Symfony (the backbone of Laravel) and MIT-licensed, it’s a safe bet. For example:
array_is_list() for cleaner, more performant API request handling.
The tradeoff? Minimal performance overhead (~1–5ms per feature call) and a temporary dependency—easily removed when we upgrade PHP later. This aligns with our roadmap to delay infrastructure costs while adopting modern features."*For Engineering (Laravel Devs):
*"Symfony’s polyfill-php81 gives us backward-compatible access to PHP 8.1 features in Laravel on PHP 7.4–8.0. Here’s why it’s worth adopting:
composer require symfony/polyfill-php81 and use features directly:
use Symfony\Polyfill\Php81\Php81;
if (Php81\array_is_list([1, 2, 3])) { ... } // Works in Laravel 8.x–9.x on PHP 7.4+.
array_is_list() in Illuminate\Validation.UserRole, OrderStatus without PHP 8.1.enum_exists behavior may differ from PHP 8.1+).For Security/Infrastructure Teams: *"This polyfill does not resolve PHP 7.4’s end-of-life (EOL) in November 2024—security updates will still stop. However, it lets us:
How can I help you explore Laravel packages today?