Download the PHP package myparcelnl/sdk without Composer

On this page you can find all versions of the php package myparcelnl/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 sdk

MyParcel PHP SDK

Latest Stable Version Total Downloads Slack support Coverage Status

Requirements

Quick start

Most v11 services take an API key in the constructor and wrap the generated API client. MyParcel Connect is the exception, see MyParcel Connect.

Services

Service Description
ShipmentCreateService Create shipments (concepts or with labels)
ShipmentQueryService Query, find by ID, find by reference
ShipmentDeleteService Delete concept shipments
ShipmentPrintService Print shipments to a printer group
ShipmentLabelsService Get label PDFs, links or direct downloads
ShipmentTrackTraceService Fetch track & trace data
ReturnShipmentService Create related or unrelated return shipments
MultiColloShipmentService Split a shipment into multiple colli
CapabilitiesService Check carrier capabilities for a shipment
CarrierContractDefinitionsService Fetch account-level carrier contract definitions
WebhookService Subscribe, unsubscribe, list webhooks
ApiKeyService Validate API key, get principal info
ConnectService Connect a shop with MyParcel Connect and keep its access token usable

See UPGRADE.md for detailed before/after examples per service.

MyParcel Connect

ConnectService authorises a shop in the merchant's browser instead of taking an API key. It is for integrations you publish and other people install, rather than a single shop you run yourself. EcommerceApiFactory then builds an e-commerce client that signs every call, which is how orders are pushed.

Connect covers one call for now, POST /webhook/orders. Every other service in this SDK still takes an API key.

See PHP SDK v11 on the developer portal for how to use it. dev/connect-poc in this repository is a page that runs the whole flow.

When the connection expires

Show the merchant a notice from about one month before the connection expires, so they reconnect in time. When the refresh token expires, the next refresh fails and the shop has to connect again.

A refresh token lasts about a year. MyParcel sends its lifetime as refreshExpiresIn in the answers of /connect/token and /connect/refresh, and the SDK stores the expiry with the installation. ConnectService::getRefreshTokenExpiresAt() returns it as a UTC DateTimeImmutable, read from storage without a request. It returns null when the shop is not connected, or connected with an SDK version that did not store the expiry yet. The first refresh after an update stores it.

ConnectService::getAccessTokenExpiresAt() does the same for the access token, which lasts about an hour. The SDK refreshes the access token itself, so you only need this date for display.

Value mapping

Use ApiMapperService to convert between delivery-options names, v1 IDs and v2 names.

Use forDeliveryType() or forPackageType() for the other categories. Conversion methods return null if no mapping exists. Use allRows() for one category or allDomains() for all three.

Shipment option names are handled by Services\Mapping\ShipmentOptionMapper. Its v2PropertyFromName() method returns the generated capabilities v2 model property, or null. For example, signature and requiresSignature both map to requires_signature.

Unsupported capabilities options

Capabilities requests omit unknown or unsupported option names. Check the request before sending it so your application can report these options or change the request.

This check validates option names accepted by the request model. It does not validate option values or determine which options a carrier offers.

Legacy services

The following are still available but will be replaced in a future release:

Use CarrierContractDefinitionsService for new account-level carrier contract definition lookups instead of CarrierOptionsWebService.

Testing

Tests use two mocking strategies:

Existing tests serve as examples for both patterns.

Support

For questions and support please contact us via [email protected] or chat with our developers directly on Slack.

Contribute

  1. Check for open issues or open a new issue to start a discussion
  2. Fork the repository and branch off from main
  3. Write tests for the new feature or bug fix
  4. Ensure all tests pass: ./vendor/bin/phpunit
  5. Submit a pull request

All versions of sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
guzzlehttp/guzzle Version ^7.10
psr/http-client Version ^1.0
psr/http-message Version ^1.1 || ^2.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 myparcelnl/sdk contains the following files

Loading the files please wait ...