PHPackages                             salesrender/plugin-core-logistic - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. salesrender/plugin-core-logistic

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

salesrender/plugin-core-logistic
================================

SalesRender plugin logistic core

0.10.1(7mo ago)0574proprietaryPHPPHP ^7.4.0

Since Dec 28Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/SalesRender/plugin-core-logistic)[ Packagist](https://packagist.org/packages/salesrender/plugin-core-logistic)[ RSS](/packages/salesrender-plugin-core-logistic/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (56)Used By (0)

Plugin Core Logistic
====================

[](#plugin-core-logistic)

> Core framework for SalesRender logistic (shipping &amp; fulfillment) plugins

[Russian version / Русская версия](readme.ru.md)

Overview
--------

[](#overview)

`salesrender/plugin-core-logistic` is the most feature-rich specialized core library in the SalesRender plugin ecosystem. It extends `salesrender/plugin-core` (via `salesrender/plugin-core-geocoder`) to provide the complete infrastructure for logistic plugins.

Logistic plugins handle two major domains:

- **Shipping (delivery)** -- Creating shipments, generating waybills, adding orders to shipments, tracking packages, canceling shipments, and removing orders
- **Fulfillment** -- Syncing inventory with external warehouses, binding SalesRender SKUs to external product identifiers, handling order fulfillment sync

A single logistic plugin operates in **one mode** determined by its class in `Info::config()`:

ClassModeDescription`LogisticPluginClass::CLASS_DELIVERY`ShippingStandard delivery providers (courier, pickup point, post)`LogisticPluginClass::CLASS_FULFILLMENT`FulfillmentWarehouse/fulfillment center integrationsInstallation
------------

[](#installation)

```
composer require salesrender/plugin-core-logistic
```

### Requirements

[](#requirements)

- PHP &gt;= 7.4
- ext-json
- `salesrender/plugin-core` ^0.4.0
- `salesrender/plugin-core-geocoder` ^0.3.0
- `salesrender/plugin-component-logistic` ^2.0.0
- `salesrender/plugin-component-purpose` ^2.0
- `xakepehok/array-to-uuid-helper` ^0.1.0

Architecture
------------

[](#architecture)

### How It Extends plugin-core

[](#how-it-extends-plugin-core)

`plugin-core-logistic` extends the chain: `plugin-core` -&gt; `plugin-core-geocoder` -&gt; `plugin-core-logistic`.

1. **WebAppFactory** (`SalesRender\Plugin\Core\Logistic\Factories\WebAppFactory`) extends the geocoder's `WebAppFactory` and automatically:

    - Adds CORS support
    - Registers batch processing actions
    - Registers the waybill form and handler at `/protected/forms/waybill`
    - Registers the track status endpoint at `/protected/track/statuses/{trackNumber}`
    - **For shipping mode:** Registers `ShippingCancelAction` and `RemoveOrdersAction` as special request actions
    - **For fulfillment mode:** Registers `SyncAction` as a special request action; adds a settings save handler that triggers fulfillment binding sync
2. **ConsoleAppFactory** (`SalesRender\Plugin\Core\Logistic\Factories\ConsoleAppFactory`) extends the base console factory and:

    - Adds batch processing commands
    - Adds the `FulfillmentSyncCommand` (`fulfillment:sync`)
    - **For fulfillment mode:** Registers three cron tasks for automatic binding sync

### What the Developer Must Implement

[](#what-the-developer-must-implement)

**For Shipping plugins:**

Interface / ClassPurpose`WaybillHandlerInterface`Process waybill form data and return a `WaybillResponse``BatchShippingHandler` (extend)Handle batch shipping: create shipments, add orders, mark as exported`ShippingCancelAction` (extend)Handle shipment cancellation requests`RemoveOrdersAction` (extend)Handle order removal from shipments**For Fulfillment plugins:**

Interface / ClassPurpose`WaybillHandlerInterface`Process waybill form data and return a `WaybillResponse``FulfillmentBindingHandlerInterface`Build product bindings from plugin settings`FulfillmentSyncHandlerInterface`Sync individual orders with the external fulfillment system`FulfillmentRemoveHandlerInterface`Handle order removal from the fulfillment system`BatchFulfillmentHandler` (extend)Handle batch fulfillment processing### Bootstrap Configuration Steps

[](#bootstrap-configuration-steps)

The `bootstrap.php` file wires everything together (see `bootstrap.example.php` in the repository):

1. Configure the database connection (`Connector::config`)
2. Set the default language (`Translator::config`)
3. Configure file upload settings (`UploadersContainer::addDefaultUploader`)
4. Configure plugin info (`Info::config` with `PluginType::LOGISTIC`)
5. Configure the settings form (`Settings::setForm`)
6. Configure autocompletes (optional)
7. Configure table previews (optional)
8. Configure batch forms and handler (`BatchContainer::config`)
9. Configure waybill form and handler (`WaybillContainer::config`)
10. **For shipping:** Configure cancel and remove actions (`ShippingContainer::config`)
11. **For fulfillment:** Configure fulfillment handlers (`FulfillmentContainer::config`)

Getting Started: Creating a Logistic Plugin
-------------------------------------------

[](#getting-started-creating-a-logistic-plugin)

### Step 1: Project Setup

[](#step-1-project-setup)

Create `composer.json`:

```
{
  "name": "your-vendor/plugin-logistic-your-provider",
  "type": "project",
  "autoload": {
    "psr-4": {
      "YourVendor\\Plugin\\Logistic\\YourProvider\\": "src/"
    }
  },
  "require": {
    "php": "^7.4.0",
    "ext-json": "*",
    "salesrender/plugin-core-logistic": "^0.7.0"
  }
}
```

```
composer install
```

### Step 2: Bootstrap Configuration

[](#step-2-bootstrap-configuration)

Create `bootstrap.php`. This example shows a **shipping** plugin:

```
