Migration and Compatibility#
This page highlights behavior and API additions that may affect usage patterns.
Recent Additions#
ArrayMultinow includeskeyBy(),indexBy(),countBy(),firstWhere(),mapWithKeys(),min/max,minBy/maxBy,values(),rekey(), and deep merge helpers.ArraySinglenow includescountBy(),mapWithKeys(),min/max,minBy/maxBy,values(),rekey(), set helpers (intersect/diff/symmetricDiff/same), and optimized strict lookups.DotNotationsupports escaped dot-path segments (for literal key dots) and path compilation cache.Collectionnow implementsIteratorAggregatesemantics for safe nested iteration and providescopy()/immutable()snapshots.Config/LazyFileConfignow includereplace(),reload(), andgetOrFail().LazyFileConfigincludesloaded()alias forisLoaded().Namespaced helpers (
Infocyph\ArrayKit\*) are now the default autoloaded helper surface; globals are optional via manual include ofsrc/functions.php.ArrayMulti::flatten($array, 0)now returns unchanged top-level values.ArraySingle::avg(),sum(),isPositive(), andisNegative()now ignore non-numeric values consistently.ArraySingle::paginate()now validates$page/$perPageand throws for values below1.ArrayMulticallback-based sort/sum/min/max-by helpers support($row, $key).ArrayMultiaddsuniqueBy(),duplicatesBy(),sortByMany(),whereBetween(),whereLike(),whereStartsWith(),whereEndsWith(),whereContains(), andfirstWhereIn().DotNotationaddshasWildcard(),paths(),matches(),rename(), andmove().Configadds typed getters (getString/getInt/getFloat/getBool/getArray/getList/getEnum), merge/state helpers (merge/overlay/snapshot/restore/changed), andreadonly()mode.CollectionaddsimmutableProcess()/pipeImmutable()explicit immutable-style pipeline entry.ArrayKitfacade addslazyCollection()and package now includesLazyCollection(generator-backed operations).New optional helpers:
ArrayShapevalidator and Laravel-compat layer (LaravelCompat\\Arr,LaravelCompat\\Collection).
Compatibility Notes#
unWrap()is the current helper/pipeline method name.Pipeline methods are mutable by design: most transformation methods update the same collection instance and return it.
Use
copy()orimmutable()before pipeline operations when functional immutability is preferred.
Recommended Upgrade Checklist#
Prefer direct static calls (
ArraySingle/ArrayMulti/DotNotation) for hot paths.Use escaped paths (for example
service\\.name) when reading/writing literal dot keys.Replace manual row indexing/grouping loops with
keyBy(),countBy(), andfirstWhere()where applicable.Use
getOrFail()for required config values in boot/runtime-critical code.