Str, Arr, and Collection helpers, this package targets lower-level PHP functions (e.g., array_merge, json_encode) where Laravel lacks typed alternatives. This creates a cohesive layer for type-safe operations across the stack.Helpers::arrayMerge() instead of array_merge()), but this requires:
null returns, array shape validation).Helpers::arrayFilter() for typed array operations in services.collect() for fluent, type-safe transformations in controllers.mixed returns, var_dump-style debugging).phpstan/extension-installer) that overlap with this package’s functionality?null returns for optional fields)?collect() or Arr:: helpers replace some use cases (e.g., array operations) without introducing new dependencies?rubix/ml, spatie/array-to-object) that offer similar or broader functionality?Helpers::arrayMap() vs. native array_map()) to ensure they meet performance SLAs for critical paths.composer require elasticms/helpers. No Laravel service provider or configuration is required, but PHPStan must be configured to recognize the package’s types.phpstan.neon snippet:
includes:
- vendor/elasticms/helpers/src/Helpers.php
array_*, str_*).phpstan analyse --level=max to quantify the impact.Helpers::arrayMerge($a, $b)).array instead of mixed).if (app()->bound('use_helpers'))) to toggle wrapped functions.@phpstan-ignore annotations (sparingly).collect() for type-safe, fluent operations (e.g., collect($data)->filter(Helpers::arrayFilter(...))).spatie/array-to-object or rubix/ml to avoid redundancy.elasticms/helpers repository for breaking changes or deprecations.composer.json to avoid unintended updates (e.g., ^7.3.0).vendor/project/helpers).array_map → Helpers::arrayMap).Helpers::jsonEncode).How can I help you explore Laravel packages today?