minwork/array
Minwork Array provides fast, well-tested helpers for nested, associative, and object arrays. Get/set/has plus map, filter, find, group, sort, and validation, with fluent-style chaining. No dependencies; modern PHP syntax.
Strengths:
Arr::get(), Arr::set()), reducing cognitive load for developers familiar with Laravel’s Arr helper.Arr::obj()->set()->remove()->getArray()), which is idiomatic in modern PHP/Laravel applications.orderByKeys, sortByKeys) address common pain points in Laravel’s Eloquent relationships, API responses, or form data.mapObjects, groupObjects, and sortObjects bridge gaps in Laravel’s built-in Collection for object arrays (e.g., Eloquent models).Gaps:
Collection class (e.g., no Collection facade wrapper or Collection method aliases). Would require manual bridging.Illuminate\Support\Collection enhancements).Pros:
composer require installation integrates seamlessly with Laravel’s dependency management.Cons:
Arr as a global function/class, which could conflict with Laravel’s Arr helper. Mitigation: Alias the package (e.g., MinworkArr) or namespace it explicitly.| Risk Area | Severity | Mitigation |
|---|---|---|
| Deprecated PHP/Laravel | High | Test against PHP 8.1/Laravel 9+; consider forking if critical bugs arise. |
| Namespace Conflicts | Medium | Rename the facade/class (e.g., MinworkArr) or use a dedicated namespace. |
| No Active Maintenance | Medium | Monitor for security vulnerabilities; prepare to fork if needed. |
| Lack of Laravel Integration | Low | Build thin wrappers for Collection integration (e.g., collect()->pipe(MinworkArr::class)). |
| Performance Overhead | Low | Benchmark against native PHP/Collection methods; likely negligible for most use cases. |
Compatibility:
Collection class (e.g., method signature conflicts, return type mismatches)?Maintenance:
Adoption:
Arr helper or third-party alternatives (e.g., spatie/array-to-object)?Integration:
Collection (e.g., static methods, dynamic facades)?Alternatives:
Illuminate\Support\Arr) be more maintainable than this package?nWink/laravel-helpers) that offer similar functionality with better support?Laravel Core Alignment:
Arr helper syntax (e.g., Arr::get(), Arr::set()), reducing learning curves for Laravel teams.User::where()->orderBy()->get()).Collection class (e.g., no Collection::pipe(MinworkArr::class)).PHP Ecosystem:
| Phase | Action Items | Dependencies |
|---|---|---|
| Evaluation | Benchmark against Laravel’s Arr and Collection methods. |
PHP 8.1+, Laravel 9+ |
| Pilot Integration | Test in a non-critical module (e.g., admin panel, legacy code). | Composer, PHPUnit/PestPHP |
| Facade/Wrappers | Create a custom facade (e.g., app/Helpers/MinworkArr.php) to avoid Arr conflicts. |
Laravel Service Provider |
| Collection Bridge | Build a Collection macro or static helper to chain with MinworkArr. |
Laravel Collection class |
| Documentation | Update docs with Laravel-specific examples (e.g., Eloquent, API responses). | GitBook or Laravel-specific wiki |
| Deprecation Plan | If maintenance stalls, fork the repo or migrate to alternatives (e.g., spatie/array-to-object). |
GitHub/GitLab fork |
| Component | Compatibility Status | Mitigation |
|---|---|---|
| PHP 8.2+ | Unverified (last release: PHP 7.4). | Test with phpunit/phpunit@^9.5 + PHP 8.2. |
| Laravel 10+ | Unverified (no Laravel-specific tests). | Check for Illuminate\Support conflicts. |
| Composer | High (standard PSR-4 autoloading). | No issues expected. |
Laravel Arr Helper |
Medium (namespace collision). | Rename facade/class (e.g., MinworkArr). |
| Eloquent Models | High (supports object arrays). | Test with hasMany, belongsToMany. |
| API Responses | High (supports nested array transformations). | Validate with laravel/framework tests. |
Phase 1: Core Integration
Arr namespace conflicts (e.g., alias to MinworkArr).get, set, has) with Laravel’s Arr for parity.Phase 2: Advanced Features
orderByKeys, sortObjects) with API payloads.How can I help you explore Laravel packages today?