vshipdk/php-sdk

SDK For vShip API

1.0.1 2024-10-02 10:17 UTC

This package is auto-updated.

Last update: 2024-10-30 13:55:48 UTC


README

Total Downloads Latest Stable Version License

Introduction

This package provides basic interface to interact with the vShip API.

Documentation

Installation

To install the SDK in your project you need to require the package via composer:

composer require vshipdk/php-sdk

Basic Usage

Initialize vShip client:

    $client = new \Vship\Client(
        apiKey: { Your API key }
    );

Send a request through the client:

    $client->getCountries();

    $client->getCarrier('car_2IGXIoELZX4Bga45tOxo52sbpJY');

Send a request with query parameters through the client:

    $client->getCarriers([
        'filter[name]' => 'Carrier name',
    ]);

Send a request with body to create API resource through the client:

    $response = $client->createOrganisation([
        'name' => 'test 5222ee5511232ff31rr33',
        'vat_number' => '123423rr4 ',
        'company_number' => 'bhifgrvbhief',
        'vat_registered' => false,
        'currency' => 'EUR',
        'timezone' => 'Europe/Copenhagen',
        'settings' => [],
    ]);

API Reference


vShip client

Carriers

Get All Carriers

    $client->getCarriers(array queryParameters = []): Carrier[]

Get Single Carrier

    $client->getCarrier(string $carrierId): Carrier

Create Carrier

    $client->createCarrier(array $payload): Carrier

Update Carrier

    $client->updateCarrier(string $carrierId, array $payload): Carrier

Delete Carrier

    $client->deleteCarrier(string $carrierId): Carrier

Carrier Accounts

Get All Carrier Accounts

    $client->getCarrierAccounts(array $queryParameters = []): CarrierAccount[]

Get Single Carrier Account

    $client->getCarrierAccount(string $carrierAccountId): CarrierAccount

Create Carrier Account

    $client->createCarrierAccount(array $payload): CarrierAccount

Update Carrier Account

    $client->updateCarrierAccount(string $carrierAccountId, array $payload): CarrierAccount

Delete Carrier Account

    $client->deleteCarrierAccount(string $carrierAccountId): CarrierAccount

Get Carrier Account Fields

    $client->getCarrierAccountFields(string $carrierCode): CarrierAccountFields

Countries

Get All Countries

    $client->getCountries(): Country

Labels

Fetch or/and print shipment labels

    $client->fetchPrintShipmentLabel(string $shipmentId, array $parameters): Label

Organisation Objects

Get All Organisation Objects

    $client->getOrganisationObjects(array $queryParameters = []): OrganisationObject[]

Get Single Organisation Object

    $client->getOrganisationObject(string $organisationObjectId): OrganisationObject

Create Organisation Object

    $client->createOrganisationObject(array $payload): OrganisationObject

Update Organisation Object

    $client->updateOrganisationObject(string $organisationObjectId, array $payload): OrganisationObject

Delete Organisation Object

    $client->deleteOrganisationObject(string $organisationObjectId): OrganisationObject

Organisations

Get All Organisation

    $client->getOrganisations(array $queryParameters = []): Organisation[]

Get Single Organisation

    $client->getOrganisation(string $organisationId): Organisation

Create Organisation

    $client->createOrganisation(array $payload): Organisation

Update Organisation

    $client->updateOrganisation(string $organisationId, array $payload): Organisation

Delete Organisation

    $client->deleteOrganisation($organisationId): Organisation

Shipments

Get All Shipments

    $client->getShipments(array $queryParameters = []): Shipment[]

Create Shipment

    $client->createShipment(array $payload): Shipment

Update Shipment

    $client->updateShipment(string $shipmentId, array $payload): Shipment

Update Shipment State

    $client->updateShipmentState(string shipmentId, string $shipmentState): Shipment

Archive Shipment

    $client->archiveShipment(string $shipmentId): Shipment

Users

Get All Users

    $client->getUsers(array $queryParameters = []): User[]

Get Single User

    $client->getUser(string $userId): User

Consolidate Invoices

Create Consolidate Invoice

    $client->createConsolidateInvoice(array $payload): Invoice