2017 © Pedro Peláez
 

library 3dbinpacking-php-api

3dbinpacking.com PHP API

image

stefandoorn/3dbinpacking-php-api

3dbinpacking.com PHP API

  • Friday, February 23, 2018
  • by stefandoorn
  • Repository
  • 2 Watchers
  • 3 Stars
  • 1,841 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Note: this package is not maintained anymore and will be abandoned. If you would like to take over, please let me know through the issues.

3dbinpacking.com PHP API Wrapper

Build Status Scrutinizer Code Quality Test Coverage Code Climate StyleCI Latest Stable Version Total Downloads License, (*1)

This library acts as a PHP wrapper around the API available at 3dbinpacking.com., (*2)

WARNING: this package is abandoned and will not receive support. It will stay available on GH.

Table Of Content

  1. Requirements
  2. Installation
  3. Example
  4. License

, (*3)

Requirements

This library uses PHP 5.5+., (*4)

To use the 3dbinpacking.com API Wrapper, you have to request an access key from 3dbinpacking.com. For every request, you will have to provide the username & API Key., (*5)

Note: this service is NOT free of usage., (*6)

, (*7)

Installation

It is recommended that you install the library through composer. To do so, run the Composer command to install the latest stable version of the API wrapper:, (*8)

composer require stefandoorn/3dbinpacking-php-api

, (*9)

Example

// Build packing request
$request = new \BinPacking3d\Entity\Request();

$bin = new \BinPacking3d\Entity\Bin();
$bin->setWidth(100);
$bin->setHeight(120);
$bin->setDepth(130);
$bin->setMaxWeight(10);
$bin->setOuterWidth(110);
$bin->setOuterHeight(130);
$bin->setOuterDepth(140);
$bin->setWeight(0.1);
$bin->setIdentifier('Test');
$bin->setInternalIdentifier(1);
$request->addBin($bin);

// Item
$item = new \BinPacking3d\Entity\Item();
$item->setWidth(50);
$item->setHeight(60);
$item->setDepth(70);
$item->setWeight(5);
$item->setItemIdentifier('Test');
$item->setProduct(['product_id' => 1]);
$request->addItem($item);

// Set extra info
$request->setApiKey('API KEY');
$request->setUsername('USERNAME');

// Perform request and get results
$boxes = $packIntoMany->run();

// Process result, in here we get all the packed boxes including the items per box
foreach ($boxes->yieldBins() as $packedBox) {
    // Get weight of box
    $weight = $packedBox->getUsedWeight();

    // Get dimensions
    $height = $packedBox->getOuterHeight();
    $width = $packedBox->getOuterWidth();
    $depth = $packedBox->getOuterDepth();

    // Get identifier
    $identifier = $packedBin->getIdentifier();

    // Get items in this box
    foreach ($packedBox->yieldItems() as $item) {
        // Get additional product data supplied (e.g. IDs, SKUs, etc)
        $product = $item->getProduct();

        // Add to database etc...
    }
}

Optional you can add a PSR-3 compatible logger to the Request object:, (*10)

$log = new \Monolog\Logger('binpacking');
$log->pushHandler(new \Monolog\Handler\StreamHandler('binpacking.log', \Monolog\Logger::DEBUG));

Optional you can add a Cache driver compatible with doctrine/cache, e.g.:, (*11)

$cacheDriver = new \Doctrine\Common\Cache\RedisCache();
$redis = new Redis;
$redis->connect($redisHost);
$cacheDriver->setRedis($redis);
$packIntoMany->setCache($cacheDriver);

, (*12)

License

3dbinpacking.com API Wrapper is licensed under The MIT License (MIT)., (*13)

The Versions

23/02 2018

dev-master

9999999-dev

3dbinpacking.com PHP API

  Sources   Download

MIT

The Requires

 

The Development Requires

api php 3d bin packing 3dbinpacking

21/07 2016

0.5

0.5.0.0

3dbinpacking.com PHP API

  Sources   Download

MIT

The Requires

 

The Development Requires

api php 3d bin packing 3dbinpacking

23/02 2016

0.4

0.4.0.0

3dbinpacking.com PHP API

  Sources   Download

MIT

The Requires

 

The Development Requires

api php 3d bin packing 3dbinpacking

30/10 2015

0.3

0.3.0.0

3dbinpacking.com PHP API

  Sources   Download

MIT

The Requires

 

The Development Requires

api php 3d bin packing 3dbinpacking

30/10 2015

dev-scrutinizer-patch-3

dev-scrutinizer-patch-3

3dbinpacking.com PHP API

  Sources   Download

MIT

The Requires

 

The Development Requires

api php 3d bin packing 3dbinpacking

30/10 2015

0.2

0.2.0.0

3dbinpacking.com PHP API

  Sources   Download

MIT

The Requires

 

The Development Requires

api php 3d bin packing 3dbinpacking

29/10 2015

dev-scrutinizer-patch-2

dev-scrutinizer-patch-2

3dbinpacking.com PHP API

  Sources   Download

MIT

The Requires

 

The Development Requires

api php 3d bin packing 3dbinpacking

28/10 2015

dev-scrutinizer-patch-1

dev-scrutinizer-patch-1

3dbinpacking.com PHP API

  Sources   Download

MIT

The Requires

 

The Development Requires

api php 3d bin packing 3dbinpacking

28/10 2015

0.1

0.1.0.0

3dbinpacking.com PHP API

  Sources   Download

MIT

The Requires

 

The Development Requires

api php 3d bin packing 3dbinpacking