Releases: oliverearl/fixed-array-functions
v3.1.0
🎉 Version 3.1.0 - Collection Parity Release
We're excited to announce Fixed Array Functions v3.1.0, bringing 23 new methods for full Laravel Collection parity! This release adds essential aggregation, conditional, and transformation methods while maintaining 100% backward compatibility.
✨ What's New
Aggregation Methods
Make data analysis a breeze with new aggregate functions:
isEmpty()/isNotEmpty()- Check if your array has datareduce()- Reduce array to a single value with a callbacksum()- Sum numeric values (supports property names!)avg()/average()- Calculate averagesmin()/max()- Find minimum and maximum values
$orders = fixedArray($orderArray);
$total = $orders->sum('amount'); // Sum by property
$average = $orders->avg('price'); // Average by property
$isEmpty = $orders->isEmpty(); // Quick empty checkConditional Methods
Add powerful conditional logic to your chains:
every()/all()- Check if all items pass a testsome()- Check if at least one item passes a testwhen()/unless()- Conditional transformations
$data = fixedArray([2, 4, 6, 8])
->when($shouldDouble, fn($arr) => $arr->map(fn($v) => $v * 2))
->unless($skipSort, fn($arr) => $arr->sort());
$allEven = $data->every(fn($v) => $v % 2 === 0); // true
$hasLarge = $data->some(fn($v) => $v > 5); // trueTransformation Methods
Transform and extract data like a pro:
reject()- Filter out items that pass the test (opposite of filter)partition()- Split array into two groups based on a conditionpluck()- Extract values from a specific propertyjoin()/implode()- Join array elements with a stringkeys()/values()- Get all keys or values
// Split valid/invalid records
[$valid, $invalid] = fixedArray($records)
->partition(fn($r) => $r->isValid())
->toArray();
// Extract and process
$names = fixedArray($users)
->pluck('name')
->join(', '); // "Alice, Bob, Charlie"Utility Methods
Enhance your workflows with:
tap()- Execute a callback and return the array (great for debugging)pipe()- Pass the array through a callback and return the result
$result = fixedArray($data)
->tap(fn($arr) => logger()->info('Processing', ['count' => $arr->count()]))
->map(fn($v) => $v * 2)
->pipe(fn($arr) => $arr->sum()); // Returns the sum🐛 Bug Fixes
Critical: filter() Now Passes Key to Callback
The filter() method now correctly passes both $value and $key to callbacks, matching Laravel Collection behavior:
// Before: Only $value was passed ❌
$filtered = $array->filter(fn($value) => $value > 5);
// Now: Both $value and $key are passed ✅
$filtered = $array->filter(fn($value, $key) => $value > 5 && $key < 10);This enhances functionality without breaking existing code (the $key parameter is optional).
Performance Improvements
filter()now iterates directly over SplFixedArray (no array conversions)- Aggregate methods work without intermediate array allocations
join()has improved type safety for null and non-scalar values
📚 Documentation
This release includes comprehensive open-source governance:
- CONTRIBUTING.md - Contribution guidelines, dev setup, and coding standards
- SECURITY.md - Security policy and vulnerability reporting
- GitHub Issue Templates - Structured bug reports and feature requests
- Pull Request Template - Comprehensive PR checklist
Plus an enhanced README with:
- Performance guidance (when to use SplFixedArray)
- Real-world usage examples
- Complete method reference (70+ methods!)
📊 By The Numbers
- 23 new methods (bringing total to 70+)
- 290 tests with 100% code coverage
- PHPStan Level 9 (strictest) - zero errors
- Fully backward compatible - safe upgrade from 3.0.0
🚀 Upgrade Guide
From 3.0.x
Simply update your composer.json:
composer update petrobolos/fixed-array-functionsNo breaking changes! All existing code will continue to work. The filter() enhancement is backward compatible (the key parameter is optional)
What's Changed (Autogenerated notes)
- Bump dependabot/fetch-metadata from 2.4.0 to 2.5.0 by @dependabot[bot] in #33
- Bump ramsey/composer-install from 3 to 4 by @dependabot[bot] in #34
- Add Laravel 13 Support by @oliverearl in #35
- v3.1.0 Improvements and new features by @oliverearl in #36
Full Changelog: v3.0.0...v3.1.0
v3.0.0
What's Changed
- Bump stefanzweifel/git-auto-commit-action from 5 to 6 by @dependabot[bot] in #27
- Bump aglipanci/laravel-pint-action from 2.5 to 2.6 by @dependabot[bot] in #28
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in #29
- Bump stefanzweifel/git-auto-commit-action from 6 to 7 by @dependabot[bot] in #31
- Bump actions/checkout from 5 to 6 by @dependabot[bot] in #32
- Version 3.0.0 by @oliverearl in #30
Full Changelog: v2.1.2...v3.0.0
v2.1.2
What's Changed
- Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0 by @dependabot in #26
Full Changelog: v2.1.1...v2.1.2
v2.1.1
What's Changed
- Update orchestra/testbench requirement from ^9.0.0 to ^10.1.0 by @dependabot in #25
Full Changelog: v2.1.0...v2.1.1
v2.1.0
What's Changed
- Bump aglipanci/laravel-pint-action from 2.4 to 2.5 by @dependabot in #23
- Laravel 12 Support by @oliverearl in #24
Full Changelog: v2.0.1...v2.1.0
v2.0.1
What's Changed
- Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 by @dependabot in #22
Full Changelog: v2.0.0...v2.0.1
v2.0.0
Breaking Changes
This drops support for versions of PHP below 8.3, and versions of Laravel below 11.
What's Changed
- v2 by @oliverearl in #21
Full Changelog: v1.2.6...v2.0.0
v1.2.6
What's Changed
- Bump dependabot/fetch-metadata from 1.4.0 to 1.5.1 by @dependabot in #15
- Bump dependabot/fetch-metadata from 1.5.1 to 1.6.0 by @dependabot in #16
- Bump actions/checkout from 3 to 4 by @dependabot in #17
- Bump ramsey/composer-install from 2 to 3 by @dependabot in #20
- Bump dependabot/fetch-metadata from 1.6.0 to 2.2.0 by @dependabot in #19
- Bump stefanzweifel/git-auto-commit-action from 4 to 5 by @dependabot in #18
Full Changelog: v.1.2.5...v1.2.6
v1.2.5
What's Changed
- docs: Update README with new badges. by @oliverearl in #13
- Bump dependabot/fetch-metadata from 1.3.6 to 1.4.0 by @dependabot in #14
Full Changelog: v1.2.4...v.1.2.5
v1.2.4
What's Changed
- Bump dependabot/fetch-metadata from 1.3.5 to 1.3.6 by @dependabot in #12
Full Changelog: v1.2.3...v1.2.4