cloudstek / php-laff
Largest Area Fit First (LAFF) 3D box packing algorithm class for PHP
Installs: 54 888
Dependents: 0
Suggesters: 0
Security: 0
Stars: 84
Watchers: 14
Forks: 32
Open Issues: 5
This package is auto-updated.
Last update: 2024-11-20 02:12:12 UTC
README
Introduction
This PHP class helps to solve the so called "3D packing problem" often seen when packing containers with boxes (eg. for a webshop). It calculates the approximate minimum container size needed to fit the boxes and also gives additional information like on which level they are packed.
The class was written using the "An Efficient Algorithm for 3D Rectangular Box Packing" paper by M. Zahid Gürbüz, Selim Akyokus, Ibrahim Emiroglu and Aysun Güran. It contains a step by step explanation of the problem and the solution.
PDF file of the document: http://www.zahidgurbuz.com/yayinlar/An%20Efficient%20Algorithm%20for%203D%20Rectangular%20Box%20Packing.pdf
Minimum Requirements
- PHP 5+
Installation
- Install with composer
composer require cloudstek/php-laff
or include the Packer.php file in your php code - Initialize the Packer class
- Call the pack() method to start packing
- Sit back, sip a beer and relax!
Example:
// Initialize boxes array $boxes = array( array( 'length' => 50, 'width' => 35, 'height' => 23 ), array( 'length' => 18, 'width' => 38, 'height' => 16 ) ); // Initialize Packer $laff = new \Cloudstek\PhpLaff\Packer(); $laff->pack($boxes); // or $laff = new \Cloudstek\PhpLaff\Packer($boxes); $laff->pack();
Please see the examples directory for more examples!