PHP code example of smart-dato / nova-systems-edi-sdk
1. Go to this page and download the library: Download smart-dato/nova-systems-edi-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/ */
smart-dato / nova-systems-edi-sdk example snippets
return [
/*
|--------------------------------------------------------------------------
| Base URL
|--------------------------------------------------------------------------
|
| The base URL for the Nova Systems EDI API.
|
*/
'base_url' => env('NOVA_SYSTEMS_EDI_BASE_URL', 'https://api.novasystems.com'),
/*
|--------------------------------------------------------------------------
| API Key
|--------------------------------------------------------------------------
|
| Your Nova Systems EDI API key for X-ApiKey authentication.
|
*/
'api_key' => env('NOVA_SYSTEMS_EDI_API_KEY'),
/*
|--------------------------------------------------------------------------
| JWT Token
|--------------------------------------------------------------------------
|
| JWT token for Bearer token authentication. If set, this will be used
| instead of the API key.
|
*/
'jwt_token' => env('NOVA_SYSTEMS_EDI_JWT_TOKEN'),
/*
|--------------------------------------------------------------------------
| Request Timeout
|--------------------------------------------------------------------------
|
| The timeout in seconds for API requests.
|
*/
'timeout' => env('NOVA_SYSTEMS_EDI_TIMEOUT', 30),
];
use SmartDato\NovaSystemsEdi\Connectors\NovaSystemsEdiConnector;
class MyService
{
public function __construct(
protected NovaSystemsEdiConnector $connector
) {}
public function doSomething()
{
// Use $this->connector to make requests
}
}
use SmartDato\NovaSystemsEdi\Connectors\NovaSystemsEdiConnector;
$connector = app(NovaSystemsEdiConnector::class);
use SmartDato\NovaSystemsEdi\Connectors\NovaSystemsEdiConnector;
// With API Key authentication
$connector = NovaSystemsEdiConnector::withApiKey('your-api-key');
// With API Key and custom base URL
$connector = NovaSystemsEdiConnector::withApiKey('your-api-key', 'https://custom-api.com');
// With JWT authentication
$connector = NovaSystemsEdiConnector::withJwt('your-jwt-token');
// With JWT and custom base URL
$connector = NovaSystemsEdiConnector::withJwt('your-jwt-token', 'https://custom-api.com');
use SmartDato\NovaSystemsEdi\Connectors\NovaSystemsEdiConnector;
$connector = new NovaSystemsEdiConnector(
apiKey: 'your-api-key',
jwtToken: null,
baseUrl: 'https://custom-api.com'
);
use SmartDato\NovaSystemsEdi\Connectors\NovaSystemsEdiConnector;
use SmartDato\NovaSystemsEdi\Data\PostShipmentRequestData;
use SmartDato\NovaSystemsEdi\Data\ShipmentContactData;
use SmartDato\NovaSystemsEdi\Data\ShipmentData;
use SmartDato\NovaSystemsEdi\Data\ShipmentGoodDetailData;
use SmartDato\NovaSystemsEdi\Data\ShipmentGoodDetailSizeData;
use SmartDato\NovaSystemsEdi\Data\SubjectData;
use SmartDato\NovaSystemsEdi\Enums\ContactSubjectType;
use SmartDato\NovaSystemsEdi\Enums\ContactTitle;
use SmartDato\NovaSystemsEdi\Enums\DeliveryDateType;
use SmartDato\NovaSystemsEdi\Enums\ParcelLabelsGenerationMode;
use SmartDato\NovaSystemsEdi\Enums\ShipmentPracticeType;
use SmartDato\NovaSystemsEdi\Enums\ShipmentStatusType;
use SmartDato\NovaSystemsEdi\Enums\ShipmentSubjectType;
use SmartDato\NovaSystemsEdi\Enums\SizeUnitOfMeasure;
use SmartDato\NovaSystemsEdi\Requests\PostShipmentRequest;
$connector = app(NovaSystemsEdiConnector::class);
$requestData = new PostShipmentRequestData(
interchangeToken: 'NEW04V0GC831NVCZK81W9S3HMJPC23C',
shipmentData: new ShipmentData(
serviceCode: 'EE',
shipmentPracticeType: ShipmentPracticeType::RoadShipment,
deliveryRequestType: DeliveryDateType::NoDeliveryPreference,
senderReferenceNumber: '0080070933',
editShipmentFullNumber: '01/2025/311916',
callerSubjectType: ShipmentSubjectType::Sender,
branchCode: '01',
shipmentDate: new DateTime('2025-10-22T10:54:44.22Z'),
shipmentStatus: ShipmentStatusType::ToBeConfirmed,
transportIncotermsCode: '1',
sender: new SubjectData(
zipCode: '31047',
city: 'Levada',
countryCode: 'IT',
address: 'Via delle Industrie 19',
address2: '',
companyName: 'La Sportiva C/o Movimoda',
province: 'TV',
),
senderDocumentCode: 'ORD',
consignee: new SubjectData(
zipCode: '74700',
city: 'Sallanches',
countryCode: 'FR',
address: 'ROUTE DU FAYET 925',
address2: '',
companyName: 'AU VIEUX CAMPEUR SALLANCHES',
),
consigneeReferenceNumber: '0080070933',
isGoodsCollectionRequested: false,
parcelLabelQuantity: 9,
goodsDetails: [
new ShipmentGoodDetailData(
packages: 9,
productClassCode: 'AR',
goodsDescription: 'Articoli sportivi',
goodsAppearanceCode: '01',
grossWeight: 154.58,
cubeMeters: 1.551,
sizes: [
new ShipmentGoodDetailSizeData(
packages: 1,
sizeUM: SizeUnitOfMeasure::Centimeters,
sizeLength: 63,
sizeWidth: 38,
sizeHeight: 72,
grossWeight: 18.26,
areStackableGoods: true,
),
// ... more sizes
],
),
],
contacts: [
new ShipmentContactData(
subjectType: ContactSubjectType::Consignee,
title: ContactTitle::NotSelected,
name: 'AU VIEUX CAMPEUR SALLANCHES',
phoneNumber: '+33450912662',
languageCode: 'en',
),
],
),
parcelLabelsGenerationMode: ParcelLabelsGenerationMode::ZplOneForEachLabel,
);
$response = $connector->send(new PostShipmentRequest($requestData));
use SmartDato\NovaSystemsEdi\Data\DeleteShipmentRequestData;
use SmartDato\NovaSystemsEdi\Requests\DeleteShipmentRequest;
$connector = app(NovaSystemsEdiConnector::class);
$requestData = new DeleteShipmentRequestData(
interchangeToken: 'NEW04V0GC831NVCZK81W9S3HMJPC23C',
serviceCode: 'EE',
shipmentFullNumber: '01/2025/311916',
);
$response = $connector->send(new DeleteShipmentRequest($requestData));