Giter Club home page Giter Club logo

shippo-php-client's Introduction

Shippo PHP API wrapper

Build Status

Shippo is a shipping API that connects you with multiple shipping carriers (such as USPS, UPS, DHL, Canada Post, Australia Post, UberRUSH and many others) through one interface.

Print a shipping label in 10 mins using our default USPS and DHL Express accounts. No need to register for a carrier account to get started.

Requirements

  • PHP 5.6 or later.

  • Shippo account - free to sign up, free to use the API. Only pay to print a live label, test labels are free.

Installation

Installing using Composer

  • Get Composer

  • Create/append the following to your composer.json file

      {
        "require": {
          "shippo/shippo-php": "1.*"
        }
      }
    
  • Install via:

      composer.phar install
    
  • To use the bindings, either user Composer's autoload:

      require_once('vendor/autoload.php');
    

    Or manually:

      require_once('/path/to/vendor/shippo/shippo-php/lib/Shippo.php');
    

Installing using Laravel

In Laravel you can install the library as normal. Then within you app/Providers/AppServiceProvider.php file's boot() method add the following:

\Shippo::setApiKey(env('SHIPPO_API_KEY'));

To take advantage of configuration caching, you can set a config parameter in config/services.php and retrieve your API key through the configuration.

\Shippo::setApiKey($this->app['config']['services.shippo.key']);

From here you can use the Shippo library anywhere in your application without setting the key when accessing it.

Testing

After installing the dependencies above, the test suite may be run:

    ./vendor/bin/phpunit

You may also run individual tests:

    ./vendor/bin/phpunit AddressTest.php

Getting Started

Simple usage looks like:

    // Replace <API-KEY> with your Shippo API Key
    Shippo::setApiKey("<API-KEY>");
    $address = Shippo_Address::
        create(
            array(
                 'object_purpose' => 'QUOTE',
                 'name' => 'John Smith',
                 'company' => 'Initech',
                 'street1' => '6512 Greene Rd.',
                 'city' => 'Woodridge',
                 'state' => 'IL',
                 'zip' => '60517',
                 'country' => 'US',
                 'phone' => '773 353 2345',
                 'email' => '[email protected]',
                 'metadata' => 'Customer ID 23424'
            ));
            
        var_dump($address);
    

We've created a number of examples to cover the most common use cases. You can find the sample code files in the examples folder. Some of the use cases we covered include:

Documentation

Please see https://goshippo.com/docs for up-to-date documentation.

About Shippo

Connect with multiple different carriers, get discounted shipping labels, track parcels, and much more with just one integration. You can use your own carrier accounts or take advantage of our discounted rates with the USPS and DHL Express. Using Shippo makes it easy to deal with multiple carrier integrations, rate shopping, tracking and other parts of the shipping workflow. We provide the API and dashboard for all your shipping needs.

Supported Features

The Shippo API provides in depth support of carrier and shipping functionalities. Here are just some of the features we support through the API:

Supported Features

The Shippo API provides in depth support of carrier and shipping functionalities. Here are just some of the features we support through the API:

  • Shipping rates & labels - Docs
  • Tracking for any shipment with just the tracking number - Docs
  • Batch label generation - Docs
  • Multi-piece shipments - Docs
  • Manifests and SCAN forms - Docs
  • Customs declaration and commercial invoicing - Docs
  • Address verification - Docs
  • Consolidator support including:
    • DHL eCommerce
    • UPS Mail Innovations
    • FedEx Smartpost
  • Additional services: cash-on-delivery, certified mail, delivery confirmation, and more - Docs

shippo-php-client's People

Contributors

assislucas avatar bosswissam avatar bryant1410 avatar eduardojuarez avatar garbee avatar guozhen-la avatar honsremind avatar mikhaill avatar mnowik avatar mylifeisshan avatar pennadl avatar rbk avatar rummykhan avatar sbeidas avatar thiagorramos avatar

Watchers

 avatar

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.