konsulting/laravel-extend-collections

A few extensions to the Laravel Collection and Arr.
7,611 2
Install
composer require konsulting/laravel-extend-collections
Latest Version:0.3.1
PHP:^8.2
Laravel:12
Older releases:11
License:MIT
Last Updated:Feb 17, 2026
Links: GitHub  ·  Packagist
Maintainer: konsulting

Laravel Extend Collections

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 are empty()
  • deep - apply a function recursively through a collection, and through arrays/collections within it
  • dotGet - retrieve an item using dot-notation
  • dotSet - set an item using dot-notation
  • dotHas - check if an item exists using dot-notation
  • dot - now standard in Laravel as dot.
  • fromDot - a little different to undot in 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

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

648,266,899 9,701
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
0.3.1 ^8.2 ^12.0 MIT
0.3.0 ^8.2 ^12.0 MIT
0.2.2 ^7.0|^8.0 ^11.0|^12.0 MIT
0.2.1 ^7.0||^8.0 ^11.0||12.0 MIT
0.2.0 ^7.0||^8.0 ^11.0.0 MIT