PHP
Package: valeryverkhoturov/wb-api-client on Packagist.
- PHP: 8.1+
- HTTP: Guzzle 7
- Autoload: PSR-4, root namespace
ValeryVerkhoturov\WbApiClient\ - Secret wrapper: per-sub-namespace
SecretString
Install
composer require valeryverkhoturov/wb-api-clientWhere the source lives
PHP is the odd language out here: Packagist requires composer.json at the root of the crawled repo, so the PHP client lives in its own repository — ValeryVerkhoturov/wb-api-client-php — instead of under clients/php in the main mono-repo.
That sibling repo is mounted as a clients/php git submodule in the main repo, so daily-check regenerates all eight languages in one place, then commits + tags both repos in lockstep. From a Composer consumer's perspective this is transparent — you just composer require and go.
Namespace shape
Root namespace: ValeryVerkhoturov\WbApiClient\. Every WB category is a PascalCase sub-namespace:
use ValeryVerkhoturov\WbApiClient\Items\Configuration;
use ValeryVerkhoturov\WbApiClient\Items\Api\ItemsApi;Sub-namespaces
General, Items, OrdersFbs, OrdersDbw, Dbs, InStorePickup, OrdersFbw, Promotion, Communications, Rates, Analytics, Reports, Finances.
Full per-sub-namespace API listing: ValeryVerkhoturov/wb-api-client-php README.
Auth
<?php
require 'vendor/autoload.php';
use ValeryVerkhoturov\WbApiClient\Items\Configuration;
use ValeryVerkhoturov\WbApiClient\Items\Api\ItemsApi;
use GuzzleHttp\Client;
$config = (new Configuration())
->setAccessToken('<your WB JWT>');
$api = new ItemsApi(new Client(), $config);
$result = $api->someEndpoint();setAccessToken takes a plain string and wraps it in a SecretString internally — the token redacts under var_dump($config) and similar dumps.
To read the raw value back:
$config->getAccessToken(); // string|nullUser-Agent
Every request sends ValeryVerkhoturov/wb-api-client/php (not the openapi-generator default). To prepend your own app identifier:
$config = (new Configuration())
->setAccessToken(TOKEN)
->setUserAgent('MyApp/1.2.3 ValeryVerkhoturov/wb-api-client/php');Custom Guzzle client
Wire your own for proxying, middleware, custom timeouts:
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
$stack = HandlerStack::create();
// $stack->push(...); // your middleware here
$http = new Client([
'timeout' => 60,
'handler' => $stack,
'proxy' => getenv('HTTPS_PROXY') ?: null,
]);
$api = new ItemsApi($http, $config);Testing
Override the host on Configuration:
$config = (new Configuration())
->setHost('http://localhost:8080')
->setAccessToken('test-token');See also
