定制 thehiddenhaku/sscc 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

thehiddenhaku/sscc

最新稳定版本:0.2

Composer 安装命令:

composer require thehiddenhaku/sscc

包简介

PHP Serial Shipping Container Code Generator

README 文档

README

A simple PHP class to calculate a full SSCC code given your vendor code and shipping number

$vendorCode = 800200800;
$shippingNumber = 1234;
$sscc = new TheHiddenHaku\SerialShippingContainerCode\SerialShippingContainerCode($vendorCode);
echo $sscc->calculate($shippingNumber);
//echoes '080020080000012346'

Installation

install with composer

composer require thehiddenhaku/sscc

Usage

First you need to instantiate the class

$sscc = new TheHiddenHaku\SerialShippingContainerCode\SerialShippingContainerCode($vendorCode, $extensionDigit);

The first parameter $vendorCode is your personal vendor code.

The code must be assigned to you (or your client) by and authority.

It can be either 7 or 9 digit long.

The second parameter $extensionDigit is an optional digit that will be added at the beginning of the code.

It defaults to 0 but you can override it with any positive integer between 0 and 9

Once the class is ready, just call the calculate() method like this

$code = $sscc->calculate($shippingNumber);

the parameter $shippingNumber id the progressive number of your shipping.

If your $vendorCode is 7 digit your $shippingNumber must be 9 digit (it will be "zerofilled" behind the scene)

if your $vendorCode is 9 digit your $shippingNumber must be 7 digit (it will be "zerofilled" behind the scene)

The method will return a complete SSCC code (with the correct Check Digit) which you can use where needed for instance in logistic labels

###Testing

I used phpunit so you can just run

vendor/bin/phpunit

Contribute

Feel free to contribute and improve the class. just fork it and open you PR

License

This library is licensed under the MIT license. Please see License file for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-20