Download the PHP package snapshotpl/shipx-php-sdk without Composer

On this page you can find all versions of the php package snapshotpl/shipx-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package shipx-php-sdk

ShipX PHP SDK

by Michał Biarda

1. Introduction

This package was created so you could easily connect your PHP app with Inpost ShipX API.

The documentation of ShipX API may be found here: https://docs.inpost24.com/display/PL/API+ShipX

The library is open sourced. Feel free to contribute!

2. Installation

The recommended way to install this package is through Composer.

Watchout: This package uses HTTPlug for HTTP client abstraction. Please check their official documentation to understand how to configure it properly with your project.

3. Anatomy of SDK

3.1. API client creation

All calls to ShipX API are made through \MB\ShipXSDK\Client\Client object. To create it, you need to provide API URL (production or sandbox) and your API key (for some actions API key is not needed).

3.2. Calling API endpoints

To call the API endpoint you need to use callMethod method of the client. It takes the following arguments:

callMethod method returns \MB\ShipXSDK\Response\Response object. You can check if the call was successful by running response's getSuccess method. The body of the response might be taken by running response's getPayload method. It will be one of the following:

callMethod method might throw:

3.3. Exemplary API call

4. API endpoints coverage

Endpoints covered: 44/57

Endpoints with integration tests: 38/57

4.1. Shipments

4.1.1. Creating a shipment in the simplified mode

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\Create

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulSimpleFlow

4.1.2. Creating a shipment in the offer mode

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\CreateOffer

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulOfferFlow

4.1.2.1. Paying for shipment

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\Buy

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulOfferFlow

4.1.2.2. Bulk selection of offers

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\SelectOffers

Integration test: No

4.1.2.3. Selecting offer

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\SelectOffer

Integration test: No

4.1.2.4. Bulk payment for shipments

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\BuyBulk

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulBatchFlowWithoutBuying

4.1.3. Creating and viewing multiple shipments

4.1.3.1. Creating multiple shipments

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\CreateBatch

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulBatchFlowWithBuying

4.1.3.2. Viewing multiple shipments

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\GetBatch

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulBatchFlowWithBuying

4.1.4. Cancelling a shipment

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\Cancel

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulCancellation

Note: From time to time Sandbox API responds with empty body instead of error payload. Empty body is expected for successful call.

4.1.5. Updating a shipment

Documentation: Link

Method: No

Integration test: No

4.1.6. Recalculating shipment prices

Documentation: Link

Method: No

Integration test: No

4.1.7. Collecting the shipment label

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\GetLabel

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulSimpleFlow

4.1.8. Collecting many labels

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\GetLabels

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulBatchFlowWithBuying

4.1.9. Collecting return labels

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\GetReturnLabels

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulSimpleFlow

4.1.10. Searching shipments

Documentation: Link

Method: \MB\ShipXSDK\Method\Shipment\GetList

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testGetListSuccessCall

Note: Quite often Sandbox shipment search cannot find shipment by ID, even though it is reachable using standard get method.

4.2. Statuses

4.2.1. List of statuses

Documentation: Link

Method: \MB\ShipXSDK\Method\Status\GetList

Integration test: \MB\ShipXSDK\Test\Integration\Client\StatusResourceTest::testGetListSuccessfulCall

4.3. Tracking a shipment

4.3.1. Shipment history

Documentation: Link

Method: \MB\ShipXSDK\Method\Tracking\Read

Integration test: \MB\ShipXSDK\Test\Integration\Client\TrackingResourceTest::testReadSuccessfulCall

Note: Sandbox API constantly responds with "Resource not found" error.

4.3.2. Shipment service history

Documentation: Link

Method: No

Integration test: No

4.4. Users

4.4.1. List of users

Documentation: Link

Method: \MB\ShipXSDK\Method\User\GetList

Integration test: No

Note: Sandbox API constantly responds with "Resource not found" error.

4.5. Organizations

4.5.1. Getting information about the Organization

Documentation: Link

Method: \MB\ShipXSDK\Method\Organization\Read

Integration test: \MB\ShipXSDK\Test\Integration\Client\OrganizationResourceTest::testReadSuccessfulCall

4.5.2. List all organizations

Documentation: Link

Method: \MB\ShipXSDK\Method\Organization\GetList

Integration test: \MB\ShipXSDK\Test\Integration\Client\OrganizationResourceTest::testGetListSuccessfulCall

4.5.3. Organization's statistics

Documentation: Link

Method: No

Integration test: No

4.6. Shipment templates

4.6.1. Downloading template

Documentation: Link

Method: No

Integration test: No

4.6.2. List of templates

Documentation: Link

Method: No

Integration test: No

4.6.3. Adding a template

Documentation: Link

Method: No

Integration test: No

4.6.4. Removing a template

Documentation: Link

Method: No

Integration test: No

4.6.5. Editing a template

Documentation: Link

Method: No

Integration test: No

4.6.6. Searching shipment templates

Documentation: Link

Method: No

Integration test: No

4.7. Dispatch points

4.7.1. Collecting information about the point

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchPoint\Read

Integration test: No

4.7.2. List of dispatch points

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchPoint\GetList

Integration test: No

4.8. Dispatch Order

4.8.1. Creating a new collection order

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchOrder\Create

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulDispatchOrderFlow

4.8.2. Collecting information about a collection order

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchOrder\Read

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulDispatchOrderFlow

4.8.3. Removing a collection order

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchOrder\Delete

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulDispatchOrderFlow

4.8.4. List of collection orders

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchOrder\GetList

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulDispatchOrderFlow

4.8.5. Creating a comment to a collection order

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchOrder\CreateComment

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulDispatchOrderFlow

4.8.6. Updating a comment to a collection order

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchOrder\UpdateComment

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulDispatchOrderFlow

4.8.7. Delete comment to the dispatch order

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchOrder\DeleteComment

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulDispatchOrderFlow

4.8.8. Calculating prices of dispatch orders

Documentation: Link

Method: \MB\ShipXSDK\Method\DispatchOrder\Calculate

Integration test: No

Note: Each correct request to Sandbox API responds with the following error: "Action available only for prepaid users."

4.8.9. Printing dispatch orders

Documentation: Link

4.8.9.1. Collection order

Method: \MB\ShipXSDK\Method\DispatchOrder\GetPrintout

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulDispatchOrderFlow

4.8.9.2. Indicated parcel numbers

Method: \MB\ShipXSDK\Method\DispatchOrder\GetPrintouts

Integration test: \MB\ShipXSDK\Test\Integration\Client\ShipmentResourceTest::testSuccessfulDispatchOrderFlow

4.9. Address book

4.9.1. List of addresses in address book

Documentation: Link

Method: \MB\ShipXSDK\Method\AddressBook\GetList

Integration test: \MB\ShipXSDK\Test\Integration\Client\AddressBookResourceTest::testSuccessfulCrudFlow

4.9.2. Collecting information about address

Documentation: Link

Method: \MB\ShipXSDK\Method\AddressBook\Read

Integration test: \MB\ShipXSDK\Test\Integration\Client\AddressBookResourceTest::testSuccessfulCrudFlow

4.9.3. Adding a new address

Documentation: Link

Method: \MB\ShipXSDK\Method\AddressBook\Create

Integration test: \MB\ShipXSDK\Test\Integration\Client\AddressBookResourceTest::testSuccessfulCrudFlow

4.9.4. Updating address

Documentation: Link

Method: \MB\ShipXSDK\Method\AddressBook\Update

Integration test: \MB\ShipXSDK\Test\Integration\Client\AddressBookResourceTest::testSuccessfulCrudFlow

4.9.4. Removing address

Documentation: Link

Method: \MB\ShipXSDK\Method\AddressBook\Delete

Integration test: \MB\ShipXSDK\Test\Integration\Client\AddressBookResourceTest::testSuccessfulCrudFlow

4.10. Services

4.10.1. List of services

Documentation: Link

Method: \MB\ShipXSDK\Method\Service\GetList

Integration test: \MB\ShipXSDK\Test\Integration\Client\ServiceResourceTest::testGetListSuccessfulCall

4.11. Mapping files

4.11.1. List of mappings

Documentation: Link

Method: No

Integration test: No

4.11.2. Export a mapping to xfile

Documentation: Link

Method: No

Integration test: No

4.11.3. Export view

Documentation: Link

Method: No

Integration test: No

4.12. Sending method

4.12.1. List of sending methods

Documentation: Link

Method: \MB\ShipXSDK\Method\SendingMethod\GetList

Integration test: \MB\ShipXSDK\Test\Integration\Client\SendingMethodResourceTest::testGetListSuccessfulCall

4.13. Cost centers MPK

4.13.1. Downloading the collection of cost centers

Documentation: Link

Method: \MB\ShipXSDK\Method\Mpk\GetList

Integration test: \MB\ShipXSDK\Test\Integration\Client\MpkResourceTest::testSuccessfulCruFlow

4.13.2. Creating a cost center

Documentation: Link

Method: \MB\ShipXSDK\Method\Mpk\Create

Integration test: \MB\ShipXSDK\Test\Integration\Client\MpkResourceTest::testSuccessfulCruFlow

4.13.3. Updating a cost center

Documentation: Link

Method: \MB\ShipXSDK\Method\Mpk\Update

Integration test: \MB\ShipXSDK\Test\Integration\Client\MpkResourceTest::testSuccessfulCruFlow

4.13.4. Downloading a single object

Documentation: Link

Method: \MB\ShipXSDK\Method\Mpk\Read

Integration test: \MB\ShipXSDK\Test\Integration\Client\MpkResourceTest::testSuccessfulCruFlow

4.14. Reports

4.14.1. Collecting COD report

Documentation: Link

Method: \MB\ShipXSDK\Method\Report\GetCod

Integration test: \MB\ShipXSDK\Test\Integration\Client\ReportResourceTest::testGetCodSuccessfulCall

4.15. Points resource

4.15.1. List of points

Documentation: Link

Method: \MB\ShipXSDK\Method\Point\GetList

Integration test: \MB\ShipXSDK\Test\Integration\Client\PointResourceTest::testGetListSuccessfulCall

4.15.2. Point details

Documentation: Link

Method: \MB\ShipXSDK\Method\Point\Read

Integration test: \MB\ShipXSDK\Test\Integration\Client\PointResourceTest::testReadSuccessfulCall

5. Known issues

The main known issue is instability of Sandbox API. From time to time newly created shipments are processed very slowly or end up in a void. Because of that integration tests sometimes fail unexpectedly. I guess we need to live with it...


All versions of shipx-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-json Version *
spatie/data-transfer-object Version ^3.7.3
psr/http-client-implementation Version ^1.0
psr/http-factory-implementation Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package snapshotpl/shipx-php-sdk contains the following files

Loading the files please wait ....