Download the PHP package deliverymatch/pdk without Composer

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

DeliveryMatch Plugin Development Kit

The DeliveryMatch Plugin Development Kit (PDK) is built for creating easy integrations with PHP E-commerce platforms. This library is a wrapper around the SDK

Requirements

Getting Started

Install the package using Composer:

The PDK needs two things from your platform before it can be used:

  1. A Repository: durable storage for checkout state, keyed by a checkout reference.
  2. A CheckoutContext: tells the PDK which checkout the current request belongs to.

The checkout reference is an opaque string your platform chooses, typically the cart or quote id. It must be stable for the whole lifetime of a checkout and reproducible from server-side code (payment webhooks, order validation hooks, cron jobs), because that is where the PDK has to find the shipment id after the shopper has left the storefront.

Implement the Repository interface

Every Repository method takes the checkout reference as its first argument. Implementations store and read data per reference and must not fall back on cookies, sessions or other request-bound state to decide which checkout a call applies to. A database table is the recommended storage: it is reachable from any request, including the ones the shopper's browser is not making.

Two things to keep in mind:

Implement the CheckoutContext interface

CheckoutContext::currentReference() answers "which checkout does the current request belong to?". Return the same reference you would pass to the Repository for that cart, or null when the request is not attributable to a checkout: payment webhooks, CLI commands, back-office requests, or a cart that has not been persisted yet and therefore has no stable id.

When currentReference() returns null, PDK read methods (findShippingOption(), getCachedOptions(), getShipmentId()) return an empty result and log a warning, and PDK write methods (fetchShippingOptions(), setSelectedOption(), addShippingOptionToShipment(), flushCheckout()) throw an InvalidStateException. Server-side code should therefore always pass the reference explicitly.

Create a PDK Bootstrapper

The Bootstrapper provides the PDK's dependency injection container with your Repository and CheckoutContext implementations. After creating the bootstrapper call ::setup() to initialize everything. Both bindings are resolved during setup(), so a missing one fails at bootstrap rather than at the first checkout call.

Interact with the PDK

Once the PDK is successfully bootstrapped you can use the PDK to interact with DeliveryMatch using the \Facade\Pdk.

Check if the API connection is successful:

In the storefront

During the shopper's checkout the current cart is known, so the checkout reference can be omitted and the PDK resolves it through your CheckoutContext.

Fetch shipping options:

Read the options fetched earlier without calling DeliveryMatch again:

Store the shipping option the shopper selected:

Look up the selected option (for example to display it in the order summary):

Server-side: link the shipment to the order

Do this from a hook that runs when the order is created or validated (order validation, payment webhook), not from the confirmation page: that page is not guaranteed to be visited. Such hooks run outside the shopper's request, so pass the checkout reference explicitly.

Update the shipment to new when the payment is received. You also have the option to update the order number and reference. Not all E-commerce platforms provide an order number before the checkout is completed.

Upgrading to 2.0

Version 2.0 keys all checkout state by an explicit checkout reference instead of "the current request". Every platform integration has to be updated; there is no compatibility layer. See CHANGELOG.md for the full list of changed signatures.

  1. Implement \DeliveryMatch\Pdk\Common\CheckoutContext and bind it in your bootstrapper next to Repository.
  2. Rewrite your Repository against storage keyed by $checkoutReference (database table recommended). Cookie or session based implementations cannot satisfy the new contract.
  3. Move shipment-to-order linking into a server-side hook and pass the cart id explicitly to addShippingOptionToShipment(), getShipmentId() and flushCheckout().
  4. Replace any code that pulled the Repository out of the container to read the shipment id or flush with Pdk::getShipmentId() and Pdk::flushCheckout().
  5. Pin deliverymatch/pdk:^2.0 in the same plugin release that ships the new repository.

All versions of pdk with dependencies

PHP Build Version
Package Version
Requires php-di/php-di Version ^7.0
php Version >=8.1
deliverymatch/sdk Version ^1.0
psr/log Version ^1.0.0 || ^2.0.0 || ^3.0.0
nyholm/psr7 Version ^1.8
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 deliverymatch/pdk contains the following files

Loading the files please wait ...