symfony/polyfill-php84
Symfony Polyfill for PHP 8.4 features, enabling newer core functions and APIs on older runtimes. Includes array_find/any/all, bcdivmod, Deprecated attribute, fpow, grapheme_str_split, mb_* trim/ucfirst/lcfirst, PDO subclasses, and ReflectionConstant.
array_find, Deprecated attribute) in Laravel applications running on PHP ≤8.3, reducing upgrade friction for teams constrained by hosting providers or compliance requirements.grapheme_str_split, mb_trim), ensuring seamless transitions to newer PHP versions.bcdivmod or fpow, saving engineering time and reducing technical debt. The MIT license ensures no vendor lock-in.array_find replaces collect()->first()).#[Deprecated] attributes for gradual API phase-outs in custom packages.mb_trim, grapheme_str_split) for localization libraries like laravel-localization.bcdivmod/fpow in e-commerce or scientific computing modules.array_find, Deprecated attribute) for new functionality.mb_trim, grapheme_str_split).bcdivmod) or scientific data (e.g., fpow) with high precision needs.HttpClient) that implicitly rely on these polyfills.array_filter()->first() with array_find) without a full PHP upgrade.array_find/array_all (e.g., advanced array_reduce logic).array_find in high-load loops).grapheme_str_split).CURL_HTTP_VERSION_3 is only needed for HTTP/3 experiments).*"This package future-proofs our Laravel stack by enabling PHP 8.4 features today—without forcing a costly upgrade. Key benefits:
array_find to simplify code (e.g., finding admin users) or Deprecated to phase out legacy APIs, reducing technical debt.mb_trim and grapheme_str_split stabilize multilingual apps (critical for [Market X] expansion).*"v1.38.1 adds critical Laravel-compatible features:
collect()->first() with array_find($users, fn($u) => $u['role'] === 'admin') for cleaner code.mb_trim() now handles null inputs (e.g., form validation).grapheme_str_split('👨👩👧👦') correctly splits emoji (PCRE ≥10.44 required).bcdivmod() ensures precision for financial calculations.#[Deprecated] for internal APIs (e.g., App\Services\LegacyService).Action Items:
array_filter()->first() with array_find() in collections.mb_trim on null in form requests.composer.json:
"require": {
"symfony/polyfill-php84": "^1.38.1"
}
bootstrap/app.php:
if (version_compare(PCRE_VERSION, '10.44') < 0) {
Log::warning('PCRE <10.44: grapheme_str_split may fail.');
}
#[Deprecated] for gradual removal."*"This release enhances security and compliance:
#[Deprecated]) align with PSR-15, reducing runtime surprises.mb_* functions for secure multilingual input validation (e.g., preventing injection via malformed Unicode).*"The array_find/array_all functions simplify data processing in Laravel:
$admin = collect($users)->filter(fn($u) => $u['role'] === 'admin')->first();
With:
$admin = array_find($users, fn($u) => $u['role'] === 'admin');
array_filter + first() for large arrays.
Use Case: Optimize [Analytics Dashboard] queries for role-based filtering."*"Key considerations:
grapheme_str_split requires PCRE ≥10.44. Audit your hosting environment (e.g., shared servers may need upgrades)./api/users).How can I help you explore Laravel packages today?