-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Igor Sazonov edited this page Mar 5, 2026
·
1 revision
This section details the configuration options for the Shippo PHP SDK. You can configure the SDK for both standalone PHP projects and Laravel applications.
When using the SDK in a standalone PHP project, you can pass an array of configuration options to the Config::make() method. The available options are:
| Option | Type | Description | Default Value |
|---|---|---|---|
api_version |
string |
The Shippo API version to use. | '2018-02-08' |
base_url |
string |
The base URL for the Shippo API. | 'https://api.goshippo.com' |
is_test |
bool |
Whether to use the Shippo test environment. | false |
timeout |
int |
The HTTP client timeout in seconds. | 30 |
retry_attempts |
int |
The number of times to retry a request on failure. | 3 |
retry_delay |
int |
The delay between retry attempts in milliseconds. | 1000 |
use Tigusigalpa\Shippo\Config;
$config = Config::make('your_api_token', [
'api_version' => '2018-02-08',
'base_url' => 'https://api.goshippo.com',
'is_test' => true,
'timeout' => 30,
'retry_attempts' => 3,
'retry_delay' => 1000, // milliseconds
]);For Laravel applications, you can publish the configuration file and set the values in your .env file. The configuration file is located at config/shippo.php after publishing.
You can set the following environment variables in your .env file:
| Variable | Description | Default Value |
|---|---|---|
SHIPPO_API_TOKEN |
Your Shippo API token. | null |
SHIPPO_API_VERSION |
The Shippo API version to use. | '2018-02-08' |
SHIPPO_BASE_URL |
The base URL for the Shippo API. | 'https://api.goshippo.com' |
SHIPPO_IS_TEST |
Whether to use the Shippo test environment. | false |
SHIPPO_TIMEOUT |
The HTTP client timeout in seconds. | 30 |
SHIPPO_RETRY_ATTEMPTS |
The number of times to retry a request on failure. | 3 |
SHIPPO_RETRY_DELAY |
The delay between retry attempts in milliseconds. | 1000 |
The config/shippo.php file contains the following options:
return [
'api_token' => env('SHIPPO_API_TOKEN'),
'api_version' => env('SHIPPO_API_VERSION', '2018-02-08'),
'base_url' => env('SHIPPO_BASE_URL', 'https://api.goshippo.com'),
'is_test' => env('SHIPPO_IS_TEST', false),
'timeout' => env('SHIPPO_TIMEOUT', 30),
'retry_attempts' => env('SHIPPO_RETRY_ATTEMPTS', 3),
'retry_delay' => env('SHIPPO_RETRY_DELAY', 1000),
];