PHP code example of latuconsinafr / 3d-bin-packager

1. Go to this page and download the library: Download latuconsinafr/3d-bin-packager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

latuconsinafr / 3d-bin-packager example snippets


$packager = new Packager(2, SortType::DESCENDING);

// To add the bin one by one
$packager->addBin(new Bin('your-bin-identifier', 4, 4.5, 5.221, 50));

// Or if you wish to add all the bins at once
$packager->addBins([
    new Bin('your-first-bin-identifier', 2.22, 5.4, 20, 100),
    new Bin('your-second-bin-identifier', 1, 2, 1.5, 10)
]);

// It would be the same for the item(s)
$packager->addItem(new Item('item-id-1', 2, 2, 2, 5));

$packager->addItems([
    new Item('item-id-2', 1, 4.225, 2, 5),
    new Item('item-id-3', 2, 5, 2, 2.525),
    new Item('item-id-4', 1, 3.5, 3, 10),
    new Item('item-id-5', 3.551, 2, 2, 12.5)
]);

$packager->withFirstFit()->pack()