1. Go to this page and download the library: Download verbb/shippy library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
verbb / shippy example snippets
use verbb\shippy\carriers\FedEx;
use verbb\shippy\carriers\UPS;
use verbb\shippy\models\Address;
use verbb\shippy\models\Package;
use verbb\shippy\models\Shipment;
// Create a shipment to set the from/to address details
$shipment = new Shipment([
// You can supply config arrays for quick setting.
'from' => new Address([
'street1' => 'One Infinite Loop',
'city' => 'Cupertino',
'stateProvince' => 'CA',
'postalCode' => '95014',
'countryCode' => 'US',
]),
]);
// You can use traditional setters if you prefer
$toAddress = new Address();
$toAddress->setStreet1('1600 Amphitheatre Parkway');
$toAddress->setCity('Mountain View');
$toAddress->setStateProvince('CA');
$toAddress->setPostalCode('94043');
$toAddress->setCountryCode('US');
$shipment->setTo($toAddress);
// Create a package (or more) to represent what we're sending
// You can use fluent syntax if you prefer
$package = new Package()
->setLength(300)
->setWidth(100)
->setHeight(80)
->setWeight(2000)
->setDimensionUnit('mm')
->setWeightUnit('g');
$shipment->addPackage($package);
// Finally, add the carrier(s) we wish to fetch rates for. With multiple carriers, rates will be
// returned across all, sorted by cheapest to most expensive
$shipment->addCarrier(new UPS([
'isProduction' => false,
'clientId' => '•••••••••••••••••••••••••••••••••••',
'clientSecret' => '•••••••••••••••••••••••••••••••••••',
'accountNumber' => '••••••',
]));
$shipment->addCarrier(new FedEx([
'isProduction' => false,
'clientId' => '•••••••••••••••••••••••••••••••••••',
'clientSecret' => '•••••••••••••••••••••••••••••••••••',
'accountNumber' => '••••••',
]));
// Fetch the rates and print the response
$rateResponse = $shipment->getRates();
echo '<pre>';
print_r($rateResponse);
echo '</pre>';
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.