2017 © Pedro Peláez
 

library pop-shipping

Pop Shipping Component for Pop PHP Framework

image

popphp/pop-shipping

Pop Shipping Component for Pop PHP Framework

  • Thursday, March 2, 2017
  • by nicksagona
  • Repository
  • 1 Watchers
  • 3 Stars
  • 582 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 1 % Grown

The README.md

pop-shipping

END OF LIFE

The pop-shipping component v2.1.0 is now end-of-life and will no longer be maintained., (*1)

Build Status Coverage Status, (*2)

OVERVIEW

pop-shipping is a component for calculating shipping rates with some of the known standard shipping vendors like UPS, FedEx and the US Post Office. It can also be extended to support other shipping vendors and their available APIs., (*3)

pop-shipping is a component of the Pop PHP Framework., (*4)

INSTALL

Install pop-shipping using Composer., (*5)

composer require popphp/pop-shipping

BASIC USAGE

Creating a shipping object

Of course, using any of the shipping adapters will require you to have a registered account with the shipping vendor:, (*6)

FedEx

The FedEx API utilizes SOAP, so you'll have to obtain a copy of the WSDL file and point to its location on your sever:, (*7)

use Pop\Shipping\Shipping;
use Pop\Shipping\Adapter\Fedex;

$shipping = new Shipping(
    new Fedex('USER_KEY', 'PASSWORD', 'ACCOUNT_NUM', 'METER_NUM', 'WSDL_FILE')
);
UPS

The UPS API utilizes basic XML under the hood:, (*8)

use Pop\Shipping\Shipping;
use Pop\Shipping\Adapter\Ups;

$shipping = new Shipping(
    new Ups('ACCESS_KEY', 'USER_ID', 'PASSWORD')
);
US Post Office

The US Post Office API utilizes basic XML under the hood as well:, (*9)

use Pop\Shipping\Shipping;
use Pop\Shipping\Adapter\Usps;

$shipping = new Shipping(
    new Usps('USERNAME', 'PASSWORD')
);

Using the shipping object to get the rates

use Pop\Shipping\Shipping;
use Pop\Shipping\Adapter\Ups;

$shipping = new Shipping(
    new Ups('ACCESS_KEY', 'USER_ID', 'PASSWORD')
);

// Set the 'ship to' address
$shipping->shipTo([
    'address' => '123 Main St.',
    'city'    => 'Some Town',
    'state'   => 'LA',
    'zip'     => '12345',
    'country' => 'US'
]);

// Set the 'ship from' address
$shipping->shipFrom([
    'company'  => 'Widgets Inc',
    'address1' => '456 Some St.',
    'address2' => 'Suite 100',
    'city'     => 'Some Town',
    'zip'      => '12345',
    'country'  => 'US'
]);

// Set the package dimensions
$shipping->setDimensions([
    'length' => 12,
    'height' => 10,
    'width'  => 8
], 'IN');

// Set the package weight
$shipping->setWeight(5.4, 'LBS');

// Go get the rates
$shipping->send();

if ($shipping->isSuccess()) {
    foreach ($shipping->getRates() as $service => $rate) {
        echo $service . ': ' . $rate . PHP_EOL;
    }
}

The above example will output something like:, (*10)

Next Day Air: $36.70
2nd Day Air: $28.84
3 Day Select: $22.25
Ground: $17.48

The Versions

02/03 2017

dev-master

9999999-dev http://www.popphp.org/

Pop Shipping Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

php shipping pop pop php shipping rates calculate shipping rates

02/03 2017

2.1.0p1

2.1.0.0-patch1 http://www.popphp.org/

Pop Shipping Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

php shipping pop pop php shipping rates calculate shipping rates

01/07 2016

2.1.0

2.1.0.0 http://www.popphp.org/

Pop Shipping Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

php shipping pop pop php shipping rates calculate shipping rates

10/05 2016

2.0.0p5

2.0.0.0-patch5 http://www.popphp.org/

Pop Shipping Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

php shipping pop pop php shipping rates calculate shipping rates

25/02 2016

2.0.0p4

2.0.0.0-patch4 http://www.popphp.org/

Pop Shipping Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

php shipping pop pop php shipping rates calculate shipping rates

25/02 2016

2.0.0p3

2.0.0.0-patch3 http://www.popphp.org/

Pop Shipping Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

php shipping pop pop php shipping rates calculate shipping rates

25/02 2016

2.0.0p2

2.0.0.0-patch2 http://www.popphp.org/

Pop Shipping Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

php shipping pop pop php shipping rates calculate shipping rates

19/02 2016

2.0.0p1

2.0.0.0-patch1 http://www.popphp.org/

Pop Shipping Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

php shipping pop pop php shipping rates calculate shipping rates

20/07 2015

2.0.0

2.0.0.0 http://www.popphp.org/

Pop Shipping Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

php shipping pop pop php shipping rates calculate shipping rates