NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #2823 most downloaded on Packagist
An implementation of the 3D (actually 4D) bin packing/knapsack problem (aka creating parcels by putting items into boxes)
Latest stable
4.3.0
Last release 3 months ago
09 Aug 2026
Ships fairly regularly
a new release about every 5 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
93 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
Readme fix only. No code changes.
Pass on the logger instance from the main Packer class into the helpers
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Optimisation when packing a large number of items
v1 of BoxPacker is in maintenance mode only, all users are encouraged to update to v3. This release has been made primarily to certify PHP 8 compatibility, unless an egregious bug is discovered (e.g. a physically impossible packing) this will be the last v1 release that includes any changes to core packing logic. (Any) further releases will be limited to compatibility with future PHP versions.
### Changed - Speed enhancements
### Changed - Speed enhancements
Added ConstrainedPlacementItem as a more powerful version of ConstrainedItem which is now deprecated
ConstrainedPlacementItem as a more powerful version of ConstrainedItem which is now deprecatedConstrainedPlacementItem as a more powerful version of ConstrainedItemConstrainedItem is now deprecated. Use ConstrainedPlacementItem insteadFixed divide by zero warning when attempting to pack an item with 0 depth
Fixed issue where internal ordering wasn't being kept
Improved item orientation selection for better packing
Work around an PHP recursion issue when comparing 2 Items
ItemsTweak composer configuration to make it easier to run the samples in the documentation
Improved box selection for certain cases
Improved item orientation selection for better packing
Do a better job of packing identical items together (previously 2 distinct item types could be mixed if they had identical physical dimensions)
Used/remaining space calculations were sometimes offset by 90 degrees leading to confusing numbers
API-compatible backport of 2.4.0 to the v1 branch. All features present except 3D packing.
API-compatible backport of 2.4.0 to the v1 branch. All features present except 3D packing.
All users of v1 are highly recommended to upgrade to v2 which removes the "keep flat" limitation from v1.
getUsed[Width|Length|Depth]() on PackedBoxes to allow for better visibility into space utilisationBoxPacker\ConstrainedItem rather than BoxPacker\ItemItemTooLargeException exception is now thrown when an item cannot fit inside any boxes rather than a generic \RuntimeExceptionAPI-compatible backport of 2.4.0. All features present except 3D packing.
getUsed[Width|Length|Depth]() on PackedBoxes to allow for better visibility into space utilisationItemTooLargeException exception is now thrown when an item cannot fit inside any boxes rather than a generic \RuntimeExceptionSome refactoring to ease future maintenance
Ensure consistency of packing between PHP 5.x and PHP7/HHVM
Items were occasionally rotated to fit into space that was actually too small for them [IBBoard]
In some cases, items that only fit in a single orientation were being recorded as fitting in the alternate, impossible one [TravisBernard]
Fix infinite loop that could occur in certain circumstances
Bugfix release, fixes issue with vertical depth calculation where last item in a box could be judged not to fit even though it would
Bugfix release, fixes issue with vertical depth calculation where last item in a box could be judged not to fit even though it would
Various refactorings to split out large functions into more readable pieces
Item interface to specify whether the item should be kept flat or not - this does not do anything yet, but adding now to avoid another major version bump later.There are no bugfixes or packing logic changes in v2.0 compared to the latest v1.5 release - the bump in version number is purely because the interface has changed slightly.
There are no bugfixes or packing logic changes in v2.0 compared to the v1.5.3 release - the bump in version number is purely because the interface changed slightly.
Packer->packIntoBox(), Packer->packBox() and Packer->redistributeWeight()Add method for retrieving the volume utilisation of a packed box.
Better stacking/depth calculations
Fix problem where available space calculation inadvertently missed off a dimension
Expose remaining space information on a packed box
Tweaked algorithm to allow limited lookahead when dealing with identical objects to better optimise placement
Generated solutions now have a second pass where multiple boxes are involved, in order to redistribute weight more evenly
### Changed - Minor calculation speedups
Now packs items side by side, not just on top of each other
Supports solutions using multiple boxes
Experimental code to get a feel for how calculations can best be implemented
Initial release
One column per quarter.