Laravel Tips

Practical engineering tips for Laravel developers and the wider PHP ecosystem.

Got a tip in mind? Contributions are always welcome.

Laravel Collections

Group Consecutive Items with chunkBy()

Use chunkBy() to split a Collection whenever the resolved value changes, without manually comparing items with the previous chunk.

READ >
Laravel Utilities

Use Immutable Dates by Default in Laravel

Configure Laravel's Date facade to use CarbonImmutable by default, and automate migrating legacy Carbon calls with Rector.

READ >
Laravel Collections

Simplify Collection Operations with Higher-Order Messages

Laravel Collections support higher-order messages through dynamic properties, allowing operations like each, map, filter, and groupBy to work directly with an item's property or method without writing boilerplate callbacks.

READ >
Laravel HTTP & API

Laravel 13.25 Reverses Merge Order in Request::all()

In Laravel 13.25, Request::all() now gives submitted input precedence over uploaded files when their keys collide, while file() continues to provide direct access to uploaded files.

READ >

// Got a tip or want to contribute? github.com/MrPunyapal/tips