myparcelnl / pdk
MyParcel Plugin Development Kit
Requires
- php: >=7.4.0
- ext-zip: *
- fruitcake/php-cors: ^1.2
- myparcelnl/sdk: ^11.0.0-beta.37@beta
- php-di/php-di: ^6.0.0
- psr/log: ^1.0.0 || ^2.0.0 || ^3.0.0
- symfony/http-foundation: ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
Requires (Dev)
- behat/behat: ^3.13
- brick/varexporter: ^0.4
- guzzlehttp/guzzle: ^7.5
- league/openapi-psr7-validator: ^0.24
- mockery/mockery: ^1.6
- nette/robot-loader: ^3.0.0
- pestphp/pest: ^1.0.0
- phpdocumentor/reflection-docblock: ^5.0.0
- phpmd/phpmd: ^2.15
- phpstan/phpstan: ^1.0.0
- rector/rector: ^1.0.0
- spatie/pest-plugin-snapshots: ^1.0.0
- symfony/console: ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0
- symfony/yaml: ^5.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 5.3.3
- 5.3.2
- 5.3.1
- 5.3.0
- 5.2.2
- 5.2.1
- 5.2.0
- 5.1.0
- 5.0.2
- 5.0.1
- 5.0.0
- 4.9.4
- 4.9.3
- 4.9.2
- 4.9.1
- 4.9.0
- 4.8.3
- 4.8.2
- 4.8.1
- 4.8.0
- 4.7.5
- 4.7.4
- 4.7.3
- 4.7.2
- 4.7.1
- 4.7.0
- 4.6.0
- 4.5.1
- 4.5.0
- 4.4.2
- 4.4.1
- 4.4.0
- 4.3.0
- 4.2.1
- 4.2.0
- 4.1.1
- 4.1.0
- 4.0.2
- 4.0.1
- 4.0.0
- v3.x-dev
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.3
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.1
- 3.0.0
- v2.x-dev
- 2.68.0
- 2.67.1
- 2.67.0
- 2.66.0
- 2.65.2
- 2.65.1
- 2.65.0
- 2.64.0
- 2.63.3
- 2.63.2
- 2.63.1
- 2.63.0
- 2.62.0
- 2.61.0
- 2.60.1
- 2.60.0
- 2.59.1
- 2.59.0
- 2.58.6
- 2.58.5
- 2.58.4
- 2.58.3
- 2.58.2
- 2.58.1
- 2.58.0
- 2.57.1
- 2.57.0
- 2.56.0
- 2.55.0
- 2.54.1
- 2.54.0
- 2.53.2
- 2.53.1
- 2.53.0
- 2.52.1
- 2.52.0
- 2.51.2
- 2.51.1
- 2.51.0
- 2.50.0
- 2.49.1
- 2.49.0
- 2.48.0
- 2.47.2
- 2.47.1
- 2.47.0
- 2.46.1
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.6
- 2.43.5
- 2.43.4
- 2.43.3
- 2.43.2
- 2.43.1
- 2.43.0
- 2.42.3
- 2.42.2
- 2.42.1
- 2.42.0
- 2.41.0
- 2.40.0
- 2.39.3
- 2.39.2
- 2.39.1
- 2.39.0
- 2.38.1
- 2.38.0
- 2.37.1
- 2.37.0
- 2.36.5
- 2.36.4
- 2.36.3
- 2.36.2
- 2.36.1
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.2
- 2.33.1
- 2.33.0
- 2.32.2
- 2.32.1
- 2.32.0
- 2.31.5
- 2.31.4
- 2.31.3
- 2.31.2
- 2.31.1
- 2.31.0
- 2.30.4
- 2.30.3
- 2.30.2
- 2.30.1
- 2.30.0
- 2.29.0
- 2.28.9
- 2.28.8
- 2.28.7
- 2.28.6
- 2.28.5
- 2.28.4
- 2.28.3
- 2.28.2
- 2.28.1
- 2.28.0
- 2.27.0
- 2.26.0
- 2.25.2
- 2.25.1
- 2.25.0
- 2.24.2
- 2.24.1
- 2.24.0
- 2.23.1
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.1
- 2.20.0
- 2.19.2
- 2.19.1
- 2.19.0
- 2.18.0
- 2.17.1
- 2.17.0
- 2.16.2
- 2.16.1
- 2.16.0
- 2.15.0
- 2.14.1
- 2.14.0
- 2.13.0
- 2.12.3
- 2.12.2
- 2.12.1
- 2.12.0
- 2.11.1
- 2.11.0
- 2.10.0
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.1
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.1
- 1.29.0
- 1.28.1
- 1.28.0
- 1.27.0
- 1.26.2
- 1.26.1
- 1.26.0
- 1.25.3
- 1.25.2
- 1.25.1
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.1
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.1
- 1.11.0
- 1.10.1
- 1.10.0
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.0
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.1
- 1.0.0
- dev-fix/INT-2268-webhook-empty-orders
- dev-claude-maintenance/INT-2300-point-int-1590-markers-to-int-2218
- dev-feat/INT-2359-use-sdk-capabilities-filter
- dev-feat/INT-2340-incoterms-per-order
- dev-feat/INT-312-deactivation-feedback
- dev-fix/INT-1596-checkout-shipment-options
- dev-fix/enable-dhl-europlus-for-eu
- dev-fix/carrier-settings-include-all-enabled-carriers
- dev-feat/INT-1504-carrier-schema-cleanup
- dev-fix/INT-1261-jsonresponse-and-agecheck-compat
- dev-feat/INT-1261-carrier-model-refactor
- dev-feat/capabilities-contract-definitions
- dev-fix/preserve-original-product-weight-in-order
- dev-temp/demo
- dev-fix/allow-international-mailbox
- dev-feat/pickup-locations-display-config
- dev-feat/replace-ups-carrier-8-with-12-13
- dev-fix/correct-price-order-export
- dev-feat/address-widget-toggle
- dev-breaking/update-v3
- dev-feat/small-package-be-pickup
- dev-fix/webhook/process-webhook-when-received
- dev-feat/add-toggle-for-delivery-options-settings
- dev-fix/pdk-dpd-shipment-export
- dev-feat-insurance-be
- dev-fix/disable-some-options-for-postnl-pickup
- dev-refactor/customs-declaration
- dev-feat/add-platform-alias-for-folder-names
- dev-fix/return-shipment-options
- dev-fix/fix-validation-schema
- dev-wip/php-8-rector
- dev-fix/set-default-country-of-origin
- dev-fix/order-status-digitalstamp-field-to-select
- dev-fix/fix-orders-without-weight
- dev-refactor/changed-order-status-digitalstamp-field
- dev-wip/improve-storage
- dev-wip/test-base-state-1
- dev-wip/test-base-state
- dev-wip/integration-tests
- dev-feat/check-subscription-permissions
- dev-fix/separate-logic-for-posting-single-note
- dev-feat/add-order-notes
- dev-feat/add-invoice
- dev-alpha
- dev-feat/currency-format
- dev-feat/add-eori-vat-to-contact-details
- dev-fix/always-return-int-as-package-type-id
- dev-feat/currency-service
- dev-fix/prevent-exporting-of-all-shipments-on-order
- dev-fix/fix-error-when-getting-pdk-version
- dev-feat/arrayable-flags
- dev-fix/pass-correct-print-positions-to-api
- dev-fix/add-physical-properties-to-shipment
- dev-doc-generator
- dev-feat/add-pdkorder-fulfilmentorder-adapter
- dev-feat/add-validation
This package is auto-updated.
Last update: 2026-11-27 16:54:31 UTC
README
The MyParcel PDK (Plugin Development Kit) is meant for developing entire plugins on PHP E-Commerce platforms. If you're just looking to connect to our API without creating an entire plugin, you should check out our php SDK.
Requirements
- PHP 7.4 – 8.5
- Composer
Documentation
For examples, guides and in-depth information, visit our Plugin Development Kit (PDK) documentation.
Support
Create an issue or contact us via our Developer Portal contact page.
Contributing
View our contribution guidelines for information on how to contribute to the PDK.
Prerequisites
- Node.js 24, version 24.21 or later
- pnpm 12, version 12.11 or later
- Docker
- No Volta on your machine. Its
yarndoes not go through corepack, so thepackageManagerfield inpackage.jsondoes not stop it.
Installation
Create .env:
cp .env.template .env
Install Node dependencies:
pnpm install
Install Composer dependencies:
docker compose up php
Running tests
Run all tests:
docker compose run php composer test
Testing on a specific PHP version
The default PHP version is 7.4. To test on a different version, change PHP_VERSION in .env and rebuild:
docker compose build --pull
docker compose run php composer test
--pull fetches the latest php-xd base image, which gets security fixes every week.
Testing your changes in a plugin
bin/pdk-dev links your local checkout of the PDK, and of js-pdk, into a plugin that uses them, for example woocommerce. It also undoes that.
Requirements:
-
git,jqand pnpm. The plugin must use pnpm. -
A checkout of js-pdk in a folder named
js-pdk, next to this repository, for exampleprojects/pdkandprojects/js-pdk. Has it another name or location? SetJS_PDK_PATHto its path. -
When the plugin runs composer in Docker, mount this repository at the same path in the container, for example in the
docker-compose.override.ymlof the plugin:services: php: volumes: - /path/to/pdk:/path/to/pdk
Put the script on your PATH once:
ln -s "$(pwd)/bin/pdk-dev" /usr/local/bin/pdk-dev
Run these commands in the root folder of the plugin:
pdk-dev on # link the PDK and js-pdk pdk-dev on --php # link only the PDK pdk-dev on --js # link only js-pdk pdk-dev off # undo both pdk-dev off --php # undo only the PDK pdk-dev off --js # undo only js-pdk
on adds a composer path repository to composer.json and pnpm link: overrides to pnpm-workspace.yaml, and installs. When the plugin has a php service in docker compose, composer runs there. off restores composer.json, composer.lock, package.json, pnpm-workspace.yaml and pnpm-lock.yaml from git, and installs again. on stops when one of these files has uncommitted changes, because off would throw them away. Never commit the changes that on makes.
on does not build js-pdk. The pdk-builder command in the plugin runs the built files of @myparcel-dev/pdk-app-builder, so build it in js-pdk after on, and again after each change to it:
pnpm --filter @myparcel-dev/pdk-app-builder build
The other js-pdk packages that the plugins use export their source and need no build. To see your changes in them, run pnpm watch in the plugin.
Adding a shipment option
Shipment options are managed through the OrderOptionDefinitionInterface system. Each option is a single Definition class that declares all its keys (shipment, capabilities, carrier settings, product settings, allow, price). All models, views, and services build their attributes and form elements dynamically from these definitions.
To add a new option:
- Create a Definition class in
src/App/Options/Definition/extendingAbstractOrderOptionDefinition. Implement:getShipmentOptionsKey()— the PDK-internal key, derived fromStr::camel(RefShipmentShipmentOptions::attributeMap()['sdk_key'])
- Register it in the
orderOptionDefinitionsarray inconfig/pdk-business-logic.php. - Optionally, add a deprecated constant to
ShipmentOptionsif platform integrations reference the key directly.
The SDK derives the capabilities key. Override getCapabilitiesOptionsKey() only for exceptions, such as returning null for an option without a capabilities equivalent.
Everything else (carrier settings, product settings, allow/price toggles, validation, frontend form fields, API export/import) is derived automatically. Run pnpm test:unit to verify the consistency tests pass.
If the option is not yet in the SDK types, update the SDK or regenerate the OpenAPI types first.
Using Claude Code? Run
/add-shipment-optionfor a guided step-by-step walkthrough that asks the right questions and generates the code.
Writing a migration
Migrations are tracked by identity in an applied_migrations setting and run exactly once per install, independent of the plugin version. There are two kinds:
- Timestamped migrations (preferred) — a file named
YYYY_MM_DD_HHMMSS_<slug>.phpin a plugin'ssrc/Migration/that returns an anonymous class extendingAbstractTimestampedMigration. The PDK auto-discovers them and runs each once regardless of version, so they fire even on release-candidate builds where version comparison is unreliable. - Versioned migrations — classes implementing
UpgradeMigrationInterfacewith agetVersion(). Deprecated: prefer a timestamped migration for new work.
To scaffold a timestamped migration, run this from a plugin checkout with the PDK linked by pdk-dev on (see Testing your changes in a plugin):
composer console generate:migration <slug>
It creates src/Migration/YYYY_MM_DD_HHMMSS_<slug>.php with empty up()/down() methods — implement up(); down() is optional and defaults to a no-op. Run composer console help generate:migration for the available options.
Linting
We use Prettier to format .json, .yml, .md and .html files.
Make sure Prettier is enabled in your IDE and runs on the following files:
{**/*,*}.{md,html,yml,json}
Set up Git hooks to run Prettier on each commit, correcting any formatting issues.
pnpm prepare
You can also run Prettier manually:
# Check formatting issues pnpm lint # Fix formatting issues pnpm lint:fix