1. Go to this page and download the library: Download very-code-com/suus-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/ */
very-code-com / suus-php example snippets
use VeryCodeCom\Suus\SuusClient;
use VeryCodeCom\Suus\Dto\{Address, Package, ShipmentOrder};
use VeryCodeCom\Suus\Enum\{Incoterm, PackageSymbol};
$client = SuusClient::sandbox('ws_yourlogin', 'your_password');
$result = $client->createShipment(new ShipmentOrder(
reference: 'ORDER-2025-001',
sender: new Address('Sender GmbH', 'Musterstr.', '1', '10115', 'Berlin', 'DE', phone: '+4930123'),
receiver: new Address('Odbiorca Sp. z o.o.', 'Marszałkowska', '100', '00-026', 'Warszawa', 'PL', phone: '+48600000'),
packages: [new Package(PackageSymbol::EUR, weightKg: 120.0)],
incoterms: Incoterm::DAP,
));
echo $result->shipmentNo; // e.g. OPLKRI2600895
echo $result->trackingUrl; // https://portal.suus.com/order-details/OPLKRI2600895
$config = new SuusConfig('ws_login', 'secret', sandbox: true, debug: true);
$client = new SuusClient($config, logger: $myPsrLogger);
try {
$client->createShipment($order);
} catch (SuusException $e) {
// Raw response is always available for inspection, regardless of the flag:
echo $e->getRawResponse(); // the exact XML SUUS returned (or null)
// Full developer report: class + message + raw response + stack trace:
echo $e->getDebugReport();
}
use VeryCodeCom\Suus\Validation\ValidationError;
foreach ($client->validate($order) as $error) {
// $error->code e.g. "PRJ00372" (reuses the SUUS code where one exists)
// $error->field e.g. "packages[0].returnable"
// $error->message / (string) $error human-readable text
echo "[{$error->code}] {$error}\n";
}
use VeryCodeCom\Suus\Validation\ValidationPolicy;
$client = new SuusClient($config, policy: ValidationPolicy::relaxed());
// or fine-grained:
$client = new SuusClient($config, policy: new ValidationPolicy(
enforceInternationalB2B: false, // allow B2C internationally
enforceServiceRouteRestrictions: true, // keep service/route checks
enforceInternationalPackagingRestrictions: true,
));
use VeryCodeCom\Suus\Routing\CallableRouteClassifier;
$client = new SuusClient($config, routeClassifier: new CallableRouteClassifier(
fn (ShipmentOrder $o): bool =>
($o->sender->getCountryCode() === 'DE' && $o->receiver->getCountryCode() === 'DE')
? false // treat DE->DE as domestic in the library
: $o->isInternational(), // default rule otherwise
));
use VeryCodeCom\Suus\Calendar\GermanCalendar;
$client = new SuusClient($config, calendar: new GermanCalendar());