bafs/illuminate-light-collections

Illuminate collection, without hundreds of Illuminate contracts

dev-main 2024-08-27 09:29 UTC

This package is auto-updated.

Last update: 2024-11-27 10:04:16 UTC


README

This package provides Illuminate Collections minus hundreds of contracts from Illuminate\Contracts that are not used by this library.

This library can be used for external libraries or projects that don't depend on Laravel framework.

Install

composer req bafs/illuminate-light-collections

Why?

Illuminate collections is a handy library to work will collections, but it requires illuminate/contracts which provides hundreds of contracts from the Illuminate framework and that are not useful when working outside the Laravel ecosystem. Only 3 contracts are used by Collections (Arrayable, CanBeEscapedWhenCastToString, Jsonable).

I don't like monkey patching, can I remove it too?

Yes, it's also possible to disable the monkey patching from the Macroable library (illuminate/macroable). To do so, use the Demacroable package (bafs/illuminate-demacroable) in your project (it will replace the Macroable trait with an empty one).