Coder Social home page Coder Social logo

sscc's Introduction

Serial Shipping Container Code (S.S.C.C.) Calculator

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.

sscc's People

Contributors

thehiddenhaku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

anulikjan avdbij

sscc's Issues

modifyin all my design

When calling the SerialShippingContainerCode() all my design is disappearing...
I check the code, and can't find any reason for that.
Any help would be greatly appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.