wuunder/connector-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wuunder/connector-php

Composer 安装命令:

composer require wuunder/connector-php

包简介

PHP connector for Wuunder API's

README 文档

README

PHP connector for Wuunder API

Installation:
composer require wuunder/connector-php

Set-up connection:
$connector = new Wuunder\Connector("API_KEY");

Create Draft bulk booking:

$draftsRequest = $connector->createBulkDrafts();

$draftsConfig = new \Wuunder\Api\Config\DraftConfig();

$booking1 = new \Wuunder\Api\Config\BookingConfig();
$booking1->setWebhookUrl("url");
$booking1->setRedirectUrl("url");

$booking2 = new \Wuunder\Api\Config\BookingConfig();
$booking2->setWebhookUrl("url");
$booking2->setRedirectUrl("url");

$draftsConfig->addBookingConfig(1, $booking1, true);
$draftsConfig->addBookingConfig(2, $booking2, true);

if ($draftsConfig->validate()) {
    $draftsRequest->setConfig($draftsConfig);

    if ($draftsRequest->fire()) {
        var_dump($draftsRequest->getDraftsResponse());
    } else {
        var_dump($draftsRequest->getDraftsResponse()->getError());
    }
} else {
    print("DraftsConfig not valid");
}

Create booking:

$booking = $connector->createBooking();

$bookingConfig = new Wuunder\Api\Config\BookingConfig();
$bookingConfig->setWebhookUrl("url");
$bookingConfig->setRedirectUrl("url");

if ($bookingConfig->validate()) {
    $booking->setConfig($bookingConfig);

    if ($booking->fire()) {
        var_dump($booking->getBookingResponse()->getBookingUrl());
    } else {
        var_dump($booking->getBookingResponse()->getError());
    }
} else {
    print("Bookingconfig not valid");
}

Create shipment:

$shipment = $connector->createShipment();

$shipmentConfig = new \Wuunder\Api\Config\ShipmentConfig();
$shipmentConfig->setDescription("Test");
$shipmentConfig->setKind("package");
$shipmentConfig->setValue(200);
$shipmentConfig->setLength(10);
$shipmentConfig->setWidth(10);
$shipmentConfig->setHeight(10);
$shipmentConfig->setWeight(210);
$shipmentConfig->setPreferredServiceLevel("cheapest");

$deliveryAddress = new \Wuunder\Api\Config\AddressConfig();
$deliveryAddress->setEmailAddress("email");
$deliveryAddress->setFamilyName("Lastname");
$deliveryAddress->setGivenName("Firstname");
$deliveryAddress->setLocality("City");
$deliveryAddress->setStreetName("Street");
$deliveryAddress->setHouseNumber("Number");
$deliveryAddress->setZipCode("Zipcode");
$deliveryAddress->setCountry("NL");

$shipmentConfig->setDeliveryAddress($deliveryAddress);

$pickupAddress = new \Wuunder\Api\Config\AddressConfig();
$pickupAddress->setEmailAddress("email");
$pickupAddress->setFamilyName("Lastname");
$pickupAddress->setGivenName("Firstname");
$pickupAddress->setLocality("City");
$pickupAddress->setStreetName("Street");
$pickupAddress->setHouseNumber("Number");
$pickupAddress->setZipCode("Zipcode");
$pickupAddress->setCountry("NL");

$shipmentConfig->setPickupAddress($pickupAddress);

if ($shipmentConfig->validate()) {
    $shipment->setConfig($shipmentConfig);

    if ($shipment->fire()) {
        var_dump($shipment->getShipmentResponse()->getShipmentData());
    } else {
        var_dump($shipment->getShipmentResponse()->getError());
    }
} else {
    print("ShipmentConfig not valid");
}

Get Parcelshops in neighbourhoud by address:

$parcelshopsRequest = $connector->getParcelshopsByAddress();

$parcelshopsConfig = new \Wuunder\Api\Config\ParcelshopsConfig();
$parcelshopsConfig->setProviders(array("CARRIERCODE"));
$parcelshopsConfig->setAddress("address");
$parcelshopsConfig->setLimit(40);

if ($parcelshopsConfig->validate()) {
    $parcelshopsRequest->setConfig($parcelshopsConfig);

    if ($parcelshopsRequest->fire()) {
        var_dump(json_encode($parcelshopsRequest->getParcelshopsResponse()->getParcelshopsData()));
    } else {
        var_dump($parcelshopsRequest->getParcelshopsResponse()->getError());
    }
} else {
    print("ParcelshopsConfig not valid");
}

Get info of a specific parcelshop:

$parcelshopRequest = $connector->getParcelshopById();

$parcelshopConfig = new \Wuunder\Api\Config\ParcelshopConfig();
$parcelshopConfig->setId("id");

if ($parcelshopConfig->validate()) {
    $parcelshopRequest->setConfig($parcelshopConfig);

    if ($parcelshopRequest->fire()) {
        var_dump(json_encode($parcelshopRequest->getParcelshopResponse()->getParcelshopData()));
    } else {
        var_dump($parcelshopRequest->getParcelshopResponse()->getError());
    }
} else {
    print("ParcelshopConfig not valid");
}

Wuunder

Wuunder offers an API for sending & receiving your parcel, pallet and document the most easy way. Ship with carriers like DHL, DPD,  GLS and PostNL, etc. Only available to ship within, from and to the Netherlands.

  • Save time preparing your orders and send all order- & shipping details fully automated to all carriers;
  • Select how you want to ship your documents, parcels and pallets: same-day, next-day or slower;
  • Use one of the >20 carriers (use our or even your own carrier contract);
  • Your shipping address and phone numbers will be validated automatically to avoid unnecessary return shipments;
  • Print one or more shipping labels at once;
  • Also organize a return or drop-shipment easily and your customer, supplier or warehouse-employee will receive the label per email;
  • A pick-up is arranged fully automated (at your, your customers or your suppliers location) or select a regular pick-up with one or more carriers;
  • You can track all shipments (from different carriers) in one handy dashboard (track-and-trace);
  • Inform the receiver directly via notification or e-mail (option). Your product pictures and personal chat message are used in the communication with the receiver;
  • You will increase your revenue, using the chat-option with your customer (option);
  • With one click you arrange a return shipment, including a pick-up or parcelshop drop-off;
  • Wuunder offers pro-active tracking of your shipments. We take action and call the carrier, receiver or supplier for you, when there are any delays, pick-up issues, etc. It’s that easy!

Our shipping API has a staging and production environment. This allows you to test all aspects of the module before you go live. Please contact Wuunder if you want to use the shipping API and we'll send the API keys asap:  Info@WeAreWuunder.com

wuunder/connector-php 适用场景与选型建议

wuunder/connector-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14.84k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 06 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「connector」 「wuunder」 「parcelshop」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 wuunder/connector-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 wuunder/connector-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 wuunder/connector-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 14.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 5
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2018-06-04