epartment/nshift-shipment-server-php-sdk 问题修复 & 功能扩展

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

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

epartment/nshift-shipment-server-php-sdk

最新稳定版本:v2.0.1

Composer 安装命令:

composer require epartment/nshift-shipment-server-php-sdk

包简介

A PHP SDK for NShift Shipment Server

README 文档

README

![Latest Version on Packagist][ico-version] Software License

A library for making requests to the nShift API.

Install

Via Composer

$ composer require epartment/nshift-shipment-server-php-sdk

Usage

Here is the example also used on nShifts own page. It submits a shipment and saves the labels as PDF's.

<?php
require_once 'vendor/autoload.php';

$actor = '63';
$key = 'sample';
$env = \Epartment\NShift\ShipmentServer\Client\Client::ENV_DEV;
$client = new \Epartment\NShift\ShipmentServer\Client\Client($actor, $key, [], null, null, $env);

$data = [
    'Kind' => 1,
    'ActorCSID' => $actor,
    'ProdConceptID' => 1032,

    'Addresses' => [
        [
            'Kind' => 2,
            'Name1' => 'Test sender',
            'Street1' => 'Test Address',
            'PostCode' => '0580',
            'City' => 'Oslo',
            'CountryCode' => 'NO'],
        [
            'Kind' => 1,
            'Name1' => 'Ola Testmann',
            'Street1' => 'Test Address 1',
            'PostCode' => '0580',
            'City' => 'Oslo',
            'CountryCode' => 'NO'
        ]
    ],

    'Lines' => [
        [
            'PkgWeight' => 5000,
            'Pkgs' => [
                [
                    'ItemNo' => 1
                ]
            ]
        ]
    ]
];

$options = [
    'Labels' => 'PDF'
];

$request = new \Epartment\NShift\ShipmentServer\Request\SubmitShipmentRequest($data, $options);

/** @var \Epartment\NShift\ShipmentServer\Response\SubmitShippingResponse $response */
$response = $client->doRequest($request);

if ($response->wasSuccessful()) {
    echo "The request was successful, labels saved in: ".getcwd()."\n";
    $response->saveLabels('label-', getcwd());
} else {
    echo "The request was not successful\n";
    print_r($response->getErrors());
}

Testing

$ composer test

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固