symfony/polyfill-php81
Symfony Polyfill for PHP 8.1 features on older runtimes: array_is_list, enum_exists, MYSQLI_REFRESH_REPLICA constant, ReturnTypeWillChange, and CURLStringFile (PHP 7.4+). Part of the Symfony Polyfill suite, MIT licensed.
This polyfill is typically used automatically by Composer when your project declares a minimum PHP version (e.g., php: "^7.4") but uses PHP 8.1+ features like array_is_list() or enum_exists(). No manual setup is required — just require a package that depends on symfony/polyfill-php81 (e.g., most modern Symfony components or Laravel packages targeting older PHP versions). To verify it’s active, call array_is_list([]) or enum_exists(MyEnum::class) on a PHP <8.1 environment — if it works without fatal errors, the polyfill is loaded.
enum_exists() or array_is_list() directly — the polyfill ensures compatibility across versions.enum_exists() to conditionally handle enums in Laravel apps running on PHP 8.0 or lower (e.g., legacy deployments).array_is_list($data) before iterating to avoid subtle bugs when array keys are non-sequential — safe for PHP <8.1 without extra function_exists() checks.Composer\Autoload\ClassLoader, but ensure your autoloader runs before any polyfill-reliant code (standard Composer setup handles this).function_exists('array_is_list') — the polyfill guarantees availability unconditionally.readonly properties or final class constants in traits from PHP 8.1 are not supported here (they require actual engine support).symfony/polyfill-php82 — avoid mixing manual polyfills to prevent conflicts.How can I help you explore Laravel packages today?