flydreamers/shipwire-api

Shipwire php integration

v0.2.5 2016-09-05 13:32 UTC

This package is auto-updated.

Last update: 2024-03-25 08:58:01 UTC


README

These library will help you with the usage of Shipwire API.

Latest Stable Version Total Downloads Latest Unstable Version License

Installing via Composer

The recommended way to install Shipwire-API is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of Shipwire-API:

composer require flydreamers/shipwire-api

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

Documentation

Initial configuration

To configure the library just call ShipwireConnector::init() function to and start using it.

To use it you only have to configure your username and password in The clientyour config-local file like this:

ShipwireConnector::init($config['username'], $config['password'], 'sandbox');

Stock

To check for Stock of a product:

$response = $stock->getStockBySKUs(['CAPTRACKERBLUE']);

If you have more than one SKU, just add them to the array like:

$response = $stock->getStockBySKUs(['CAPTRACKERBLUE', 'CAPTRACKERRED', 'ETCETERA']);

Extra parameters can be used. See \flydreamers\shipwire\Stock for more information.

Rates

You can ask Shipwire API for a shipping rate using Rate class.

$rate = new Rate;
$options = [
    "currency" => "USD",
    "groupBy" => "all",
    "canSplit" => 1,
    "warehouseArea" => "US"
];

$address = Address::createFromArray([
    "address1" => "6501 Railroad Avenue SE",
    "address2" => "Room 315",
    "address3" => "",
    "city" => "Snoqualmie",
    "postalCode" => "85283",
    "region" => "WA",
    "country" => "US",
    "isCommercial" => 0,
    "isPoBox" => 0
]);

$items = [
    ['sku' => 'CAPTRACKERBLUE', 'quantity' => 3]
];

$shippingInfo = $rate->quote($address, $items, $options);

Orders

$order = new \flydreamers\shipwire\Order();

TBD

##Issues and Feature Requests

If you have issues to report, or issues to request, use the issue tracker in Github.

##Contributing

Currently, the library isn't very feature rich or mature. If you'd like to offer improvements:

  1. Fork it
  2. Create your feature branch git checkout -b feature-name
  3. Commit your changes git commit -am 'Add feature' *
  4. Push the branch git push origin feature-name
  5. Create a pull request

##Contact

Have a question? I'm on twitter: @sebathi

##License

MIT