vshipdk / php-sdk
SDK For vShip API
1.0.1
2024-10-02 10:17 UTC
Requires
- php: ~8.1.0 | ~8.2.0 | ~8.3.0
- ext-json: *
- cuyz/valinor: ^1.13
- guzzlehttp/guzzle: ^7.5.0
Requires (Dev)
- laravel/pint: ^1.18
- phpro/grumphp: ^2.8
- phpstan/phpstan: ^1.12
- symfony/var-dumper: ^6.2
- yieldstudio/grumphp-laravel-pint: ^1.0
This package is auto-updated.
Last update: 2024-10-30 13:55:48 UTC
README
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
$client->getCarriers(array queryParameters = []): Carrier[]
$client->getCarrier(string $carrierId): Carrier
$client->createCarrier(array $payload): Carrier
$client->updateCarrier(string $carrierId, array $payload): Carrier
$client->deleteCarrier(string $carrierId): Carrier
Carrier Accounts
$client->getCarrierAccounts(array $queryParameters = []): CarrierAccount[]
$client->getCarrierAccount(string $carrierAccountId): CarrierAccount
$client->createCarrierAccount(array $payload): CarrierAccount
$client->updateCarrierAccount(string $carrierAccountId, array $payload): CarrierAccount
$client->deleteCarrierAccount(string $carrierAccountId): CarrierAccount
$client->getCarrierAccountFields(string $carrierCode): CarrierAccountFields
Countries
$client->getCountries(): Country
Labels
$client->fetchPrintShipmentLabel(string $shipmentId, array $parameters): Label
Organisation Objects
$client->getOrganisationObjects(array $queryParameters = []): OrganisationObject[]
$client->getOrganisationObject(string $organisationObjectId): OrganisationObject
$client->createOrganisationObject(array $payload): OrganisationObject
$client->updateOrganisationObject(string $organisationObjectId, array $payload): OrganisationObject
$client->deleteOrganisationObject(string $organisationObjectId): OrganisationObject
Organisations
$client->getOrganisations(array $queryParameters = []): Organisation[]
$client->getOrganisation(string $organisationId): Organisation
$client->createOrganisation(array $payload): Organisation
$client->updateOrganisation(string $organisationId, array $payload): Organisation
$client->deleteOrganisation($organisationId): Organisation
Shipments
$client->getShipments(array $queryParameters = []): Shipment[]
$client->createShipment(array $payload): Shipment
$client->updateShipment(string $shipmentId, array $payload): Shipment
$client->updateShipmentState(string shipmentId, string $shipmentState): Shipment
$client->archiveShipment(string $shipmentId): Shipment
Users
$client->getUsers(array $queryParameters = []): User[]
$client->getUser(string $userId): User
Consolidate Invoices
$client->createConsolidateInvoice(array $payload): Invoice