PHP code example of shippo / shippo-php

1. Go to this page and download the library: Download shippo/shippo-php 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/ */

    

shippo / shippo-php example snippets


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

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

    // 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);