The Bags package in PHP and Laravel helps create immutable value objects, providing type safety, data casts, and built-in validation. It can replace regular arrays in your code to enhance data encapsulation. The package integrates with Laravel's Collection and Validation features and supports Eloquent casts and injecting validated Bag objects into controllers. Key features include immutability, strong typing, value casting, collection support, and composability. The package also includes an Artisan command to generate Bags.

2m read timeFrom laravel-news.com
Post cover image

Sort: