Strengths:
Arrayy::where(), Arrayy::sort(), Arrayy::group()) aligns well with Laravel’s collection-like operations (e.g., Eloquent collections, Blade loops).Fit for Laravel Use Cases:
array_* functions with fluent, readable syntax.array_map() calls to fluent Arrayy chains).Potential Gaps:
Stream helpers).Ease of Adoption:
composer require voku/arrayy).array_* functions (e.g., Arrayy::sort($array) vs sort($array)).Arrayy::make()) for consistency with Laravel’s ecosystem.Testing & Debugging:
Low Risk:
array_* functions for complex operations (e.g., nested filtering).Mitigable Risks:
Arrayy::safe()->where(...)).array_key_exists), native functions may suffice. Mitigation: Reserve Arrayy for complex, reusable logic.Where will this be most impactful?
array_filter(array_map(...)) chains with Arrayy::where()->map()->filter().How will we enforce immutability?
ImmutableArrayy) or rely on developer discipline?Performance trade-offs?
Team adoption barriers?
Arrayy vs. native functions for a real-world use case (e.g., Laravel Nova tooling).Long-term maintenance:
Laravel Ecosystem Synergy:
Arrayy can extend Laravel Collections via a trait or helper (e.g., Collection::arrayy()).@php $filtered = Arrayy::where($items, fn($i) => $i['active']) @endphp).Arrayy::sort($data)->keyBy('id')).Arrayy::chunk($records, 100)).Non-Laravel PHP:
Phase 1: Pilot Project
array_* functions with Arrayy equivalents.Phase 2: Facade/Helper Integration
Arrayy::make($array)) for consistency.// Before
$filtered = array_filter(array_map(fn($item) => $item['name'], $items));
// After
$filtered = Arrayy::make($items)->map('name')->where(fn($name) => strlen($name) > 3);
Phase 3: Collection Extension (Optional)
use Voku\Arrayy\Arrayy;
class ExtendedCollection extends \Illuminate\Support\Collection {
public function arrayy(): Arrayy {
return Arrayy::make($this->items);
}
}
$collection->arrayy()->groupBy('category');
Phase 4: Documentation & Training
Arrayy vs. native function comparisons.| Step | Priority | Effort | Dependencies |
|---|---|---|---|
| Install & Benchmark | High | Low | None |
| Pilot Module | High | Medium | Dev team buy-in |
| Facade Integration | Medium | Low | Pilot success |
| Collection Trait | Low | Medium | Facade stability |
| Documentation | Medium | Low | Pilot feedback |
Pros:
Cons:
ImmutableArrayy), maintain these internally.Mitigations:
composer.json (e.g., ^1.0).Arrayy operations.memory_get_usage()).| Scenario | Impact | Mitigation |
|---|---|---|
| Package abandonment | Low | Fork or switch to alternative |
How can I help you explore Laravel packages today?