shippo / shippo-php
A PHP library for connecting with multiple carriers (FedEx, UPS, USPS) using Shippo.
Installs: 1 438 674
Dependents: 2
Suggesters: 0
Security: 0
Stars: 161
Watchers: 42
Forks: 91
Open Issues: 30
Requires
- php: >=7.3
- ext-curl: *
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: 9.5.*
- dev-master
- 3.x-dev
- v2.0.0
- v1.5.0
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.0
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.1
- v1.0.0
- dev-AdrianCollinsShippo-patch-1
- dev-snyk-scan
- dev-github-actions-setup
- dev-php/release/2.1
- dev-api-version-v4
- dev-stage
- dev-mootrichard-patch-1
- dev-revert-42-namespacing
- dev-stash-namespaceing-changes
- dev-namespacing
- dev-rollback-namespace-changes
- dev-version-bump
- dev-fix_phpunit_version
- dev-readme-travis-badge-master
- dev-issues/1/ssl-certs-error-CURLE_SSL_CACERT
- dev-add_batch
- dev-updated-examples
- dev-adding-version-support
- dev-remove-CURLOPT_FOLLOWLOCATION
- dev-fix-issue-16-boolean-variables
- dev-updated-examples-with-sync
- dev-fix-sleep-integer
- dev-shippotoken-auth-support
- dev-revert-8-revert-5-master
- dev-revert-5-master
- dev-add_carrier_accounts_support
- dev-issues/7
This package is not auto-updated.
Last update: 2024-12-22 23:50:44 UTC
README
⚠️ Shippo no longer actively maintains this library
However, you can use it as a starting point and update it for your needs and future changes to our APIs.
You can use our Open API Specification to build your own library using tools like the OpenAPI Generator and Swagger Codegen.
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
-
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' => 'jmercouris@iit.com', '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:
- Basic domestic shipment
- International shipment - Custom forms, interntational destinations
- Price estimation matrix
- Retrieve rates, filter by delivery time and purchase cheapest label
- Retrieve rates, purchase label for fastest delivery option
- Retrieve rates so customer can pick preferred shipping method, purchase label
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