stefandoorn/3dbinpacking-php-api
最新稳定版本:0.5
Composer 安装命令:
composer require stefandoorn/3dbinpacking-php-api
包简介
3dbinpacking.com PHP API
关键字:
README 文档
README
3dbinpacking.com PHP API Wrapper
This library acts as a PHP wrapper around the API available at 3dbinpacking.com.
WARNING: this package is abandoned and will not receive support. It will stay available on GH.
Table Of Content
Requirements
This library uses PHP 5.5+.
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.
Note: this service is NOT free of usage.
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:
composer require stefandoorn/3dbinpacking-php-api
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:
$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.:
$cacheDriver = new \Doctrine\Common\Cache\RedisCache();
$redis = new Redis;
$redis->connect($redisHost);
$cacheDriver->setRedis($redis);
$packIntoMany->setCache($cacheDriver);
License
3dbinpacking.com API Wrapper is licensed under The MIT License (MIT).
stefandoorn/3dbinpacking-php-api 适用场景与选型建议
stefandoorn/3dbinpacking-php-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.86k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 10 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「bin packing」 「3d」 「3dbinpacking」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 stefandoorn/3dbinpacking-php-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 stefandoorn/3dbinpacking-php-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 stefandoorn/3dbinpacking-php-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Collection of usefull PHP utilities.
A PSR-7 compatible library for making CRUD API endpoints
Flarum extension to manage deleted (hidden) discussions
An implementation of the 3D (actually 4D) bin packing/knapsack problem (aka creating parcels by putting items into boxes)
PHP project binaries for developers
Alfabank REST API integration
统计信息
- 总下载量: 1.86k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-28