Skip to content

v4.0.0

Compare
Choose a tag to compare
@dvdoug dvdoug released this 04 Dec 22:28
· 11 commits to master since this release

Added

  • Added new enumeration Rotation with values Never, KeepFlat and BestFit
  • Added new getAllowedRotation() method to the Item interface to replace getKeepFlat(). This should return
    one of the new Rotation enum values
  • Added new generateVisualisationURL() method to PackedBox and PackedBoxList. This will generate a custom URL for
    a visualisation you can access via the BoxPacker website
  • Added new packAllPermutations() method to Packer to calculate all possible box combinations
  • Added throwOnUnpackableItem() to Packer to control if an exception is thrown (or not) if an unpackable item is
    found (defaults to true, consistent with previous behaviour)
  • Added getUnpackedItems() to Packer to retrieve the list of items that could not be packed (only applicable if
    exceptions are disabled)
  • PackedBox now has readonly public properties ->box and ->item
  • PackedItem now has readonly public properties ->item, ->x, ->y, ->z, ->width, ->length, ->depth

Changed

  • Minimum PHP version is now 8.2
  • Exceptions are now in the DVDoug\BoxPacker\Exception namespace (previously DVDoug\BoxPacker)
  • The signature of the ->canBePacked method on the ConstrainedPlacementItem interface has been changed to replace the
    first two arguments(Box $box, PackedItemList $alreadyPackedItems) with PackedBox $packedBox. This allows
    callbacks to make use of the helper methods provided on PackedBox. Access to the box and items can be done via
    $packedBox->box and $packedBox->items
  • NoBoxesAvailableException now has a ->getAffectedItems() method instead of ->getItem(). This should allow
    improved handling of the exception inside calling applications when multiple items cannot be packed

Removed

  • Removed getBox() and getItems() from PackedBox. Use the new public properties instead
  • Removed ->getItem(), ->getX(), ->getY(), ->getZ(), ->getWidth(), ->getLength() and ->getDepth()
    from PackedItem. Use the new public properties instead
  • Removed deprecated ConstrainedItem. You should use ConstrainedPlacementItem as a replacement
  • Removed getKeepFlat() from the Item interface
  • Removed InfalliblePacker. You can now get the same behaviour by calling ->throwOnUnpackableItem(false) and
    ->getUnpackedItems() on the main Packer class