1. Go to this page and download the library: Download shipstream/ups-rest-php-sdk 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/ */
shipstream / ups-rest-php-sdk example snippets
$config = new \ShipStream\Ups\Config([
// Whether to send the requests to the UPS Customer Integration Environment instead of the production environment.
// Optional, defaults to false.
'use_testing_environment' => true,
// The grant type to use for obtaining an access token. Available options: 'client_credentials', 'authorization_code'.
// Optional, defaults to 'client_credentials'.
'grant_type' => \ShipStream\Ups\Config::GRANT_TYPE_CLIENT_CREDENTIALS,
// Your Client ID obtained from UPS Developer portal.
'client_id' => 'your_client_id',
// Your Client Secret obtained from UPS Developer portal.
'client_secret' => 'your_client_secret',
// The URL to redirect to after authenticating with UPS using Authorization Code flow.
// Required only when using Authorization Code flow, defaults to an empty string.
'redirect_uri' => 'https://example.com/oauth/callback',
]);
$client = \ShipStream\Ups\ClientFactory::create($config);