Skip to content

Releases: dshafik/bag

Laravel DebugBar Support

05 Mar 09:59
Compare
Choose a tag to compare

What's Changed

  • feat: Add Laravel DebugBar Collector by @dshafik in #83

Full Changelog: 2.3.0...2.4.0

Laravel 12 support

25 Feb 11:54
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.2.0...2.3.0

var_export() support and improved exception messages

07 Feb 07:05
Compare
Choose a tag to compare

What's Changed

  • docs: Add versioned docs by @dshafik in #73
  • feat: Add support for var_export() by @dshafik in #75
  • feat: Improve AdditionalPropertiesException message to include bag class name by @dshafik in #76
  • feat: Add support for var_export() to Collection by @dshafik in #77
  • fix: Fix Eloquent casting for collections by @dshafik in #78
  • build: test docs build during PR by @dshafik in #79
  • chore(deps): bump katex from 0.16.10 to 0.16.21 by @dependabot in #68

Full Changelog: 2.1.0...2.1.1

Add the Ability to Strip Extra Params

26 Jan 13:16
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.0.3...2.1.0

Fix an issue with eloquent casting and nested bags

24 Jan 07:38
Compare
Choose a tag to compare

What's Changed

  • fix: ensure nested bags are cast correctly with Eloquent by @dshafik in #71 (thanks to @ agentphoenix for the report)

Full Changelog: 2.0.2...2.0.3

Fix an issue with name mapping when running validation

10 Jan 01:34
Compare
Choose a tag to compare

What's Changed

  • fix: use input aliases for validation by @dshafik in #67

Full Changelog: 2.0.1...2.0.2

Fix a bug where route params overwrites explicitly set bag data

09 Jan 05:29
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.0.0...2.0.1

Breaking Changes: Support for Union Types & Fill Nullables

05 Jan 22:38
Compare
Choose a tag to compare

What's Changed

Breaking Changes

This release has one major breaking change, and a minor breaking change:

Casting with Union Types

To support union types fully, the \Bag\Casts\CastsPropertySet::set() method signature has changed the first argument from:

public function set(string $propertyType, string $propertyName, \Illuminate\Support\Collection $properties): mixed

to:

public function set(\Bag\Collection $propertyTypes, string $propertyName, \Illuminate\Support\Collection $properties): mixed

To update your code and retain the previous behavior, you will want to do the following:

- public function set(string $propertyType, string $propertyName, \Illuminate\Support\Collection $properties): mixed
- {
+ public function set(\Bag\Collection $propertyTypes, string $propertyName, \Illuminate\Support\Collection $properties): mixed
+ {
+       $propertyType = $propertyTypes->first();

Fill Nullables

The behavior when instantiating a Bag has changed such that arguments that are nullable without a default value are filled with nulls. Previously, this would have caused exception to be thrown. This solves for a common scenario when you are filling a Bag from user input.

readonly class MyBag extends Bag {
    public function __construct(
         public ?string $name
    }
}

// Bag 1.4.0 (and older)
MyBag::from([]); // throws MissingPropertiesException

// Bag 2.0.0+
MyBag::from([]); // MyBag { $name = null }

Full Changelog: 1.4.0...2.0.0

Manual Validation, To Collection, PHP 8.4 support, Bug Fixes

03 Jan 17:02
Compare
Choose a tag to compare

What's Changed

  • fix: use the applications Laravel validator when available by @dshafik in #60
  • feat: Add toCollection() method by @dshafik in #61
  • feat: Add better support for optional validation by @dshafik in #62
  • feat: Finalize PHP 8.4 support by @dshafik in #63

Full Changelog: 1.3.2...1.4.0

Fix handling of extra properties

06 Dec 00:07
Compare
Choose a tag to compare

What's Changed

  • fix: Allow additional object properties (fixes #54) by @dshafik in #56
  • fix: Fix phpdocs for the \Bag\Attributes\Factory constructor by @dshafik in #57

Full Changelog: 1.3.1...1.3.2