konsulting / laravel-extend-collections
A few extensions to the Laravel Collection and Arr.
Installs: 6 713
Dependents: 2
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/konsulting/laravel-extend-collections
Requires
- php: ^8.2
- illuminate/collections: ^12.0
- illuminate/support: ^12.0
Requires (Dev)
- laravel/pint: ^1.27
- phpunit/phpunit: ^11.5
- rector/rector: ^2.3
This package is auto-updated.
Last update: 2026-02-17 18:15:29 UTC
README
A few extensions to the Laravel Collection and Arr.
Installation
composer require konsulting/laravel-extend-collections
Using Laravel
This package will auto-register the service provider.
Not using Laravel
There is a simple namespaced helper function to assist with extending Collection and Arr.
// Inside your application code, run: \Konsulting\Laravel\load_collection_extensions();
Arr Extensions
fromDot- convert an array where the keys are dot-notation indexed to a nested array
Collection extensions
dropEmpty- drop items whose values areempty()deep- apply a function recursively through a collection, and through arrays/collections within itdotGet- retrieve an item using dot-notationdotSet- set an item using dot-notationdotHas- check if an item exists using dot-notationdot- now standard in Laravel asdot.fromDot- a little different toundotin Laravel.
Contributing
Contributions are welcome and will be fully credited. We will accept contributions by Pull Request.
Please:
- Use the PSR-2 Coding Standard
- Add tests, if you’re not sure how, please ask.
- Document changes in behaviour, including readme.md.
Testing
We use PHPUnit
Run tests using PHPUnit: vendor/bin/phpunit