Immutable & Strongly typed
Bag value objects are immutable and strongly typed, a safer and more predictable way to work with data.
You're browsing the documentation for an old version of Bag. Consider upgrading to the latest version.
Bag helps you create immutable value objects. It's a great way to encapsulate data within your application.
Bag prioritizes immutability and type safety with built-in validation and data casting.
Value objects should be used in place of regular arrays, allowing you enforce type safety and immutability.
Bag is framework-agnostic, but it works great with Laravel. Bag uses standard Laravel Collections and Validation. In addition, it will automatically inject Bag\Bag
value objects into your controllers with validation.