PHPackages                             salesrender/plugin-component-purpose - 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-component-purpose

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

salesrender/plugin-component-purpose
====================================

SalesRender plugin purpose component

2.0.5(1y ago)0864↓50%4proprietaryPHPPHP &gt;=7.4.0

Since Jul 31Pushed 3mo ago2 watchersCompare

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

READMEChangelogDependencies (2)Versions (15)Used By (4)

salesrender/plugin-component-purpose
====================================

[](#salesrenderplugin-component-purpose)

Plugin purpose classification component for the SalesRender plugin ecosystem. Provides enum-like value objects that categorize plugins by their functional class (what a plugin does) and the entity type it operates on (what data it handles).

Installation
------------

[](#installation)

```
composer require salesrender/plugin-component-purpose
```

Requirements
------------

[](#requirements)

RequirementVersionPHP&gt;= 7.4.0ext-json\*xakepehok/enum-helper^0.1.0Overview
--------

[](#overview)

Every SalesRender plugin declares its **purpose** -- a combination of a **class** (the kind of work it performs) and an **entity** (the data scope it operates on). The purpose is set once, during plugin bootstrap, and is used by the platform to route orders to the correct plugin.

The hierarchy is:

```
PluginPurpose
  +-- PluginClass (abstract)
  |     +-- MacrosPluginClass   (EXPORTER, HANDLER, IMPORTER)
  |     +-- LogisticPluginClass (DELIVERY, FULFILLMENT)
  |     +-- PbxPluginClass      (SIP, WEBHOOK)
  |     +-- ResalePluginClass   (RESALE)
  +-- PluginEntity              (ORDER, UNSPECIFIED)

```

Key Classes
-----------

[](#key-classes)

### PluginPurpose

[](#pluginpurpose)

Container that combines a `PluginClass` and a `PluginEntity`. Implements `JsonSerializable`.

MethodSignatureDescription`__construct``__construct(PluginClass $class, PluginEntity $entity)`Creates a new purpose from a class and entity pair`getClass``getClass(): PluginClass`Returns the plugin class`getEntity``getEntity(): PluginEntity`Returns the plugin entity`isEquals``isEquals(?self $purpose): bool`Compares two purposes for equality (both class and entity must match)`jsonSerialize``jsonSerialize(): array`Serializes to `['class' => ..., 'entity' => ...]``factory``static factory(array $data): self`Creates an instance from an associative array with `class` and `entity` keys### PluginClass (abstract)

[](#pluginclass-abstract)

Abstract base for all plugin class categories. Extends `EnumHelper`.

MethodSignatureDescription`__construct``__construct(string $entity)`Creates an instance; throws `OutOfEnumException` if the value is invalid`get``get(): string`Returns the string value of the class`isEquals``isEquals(?self $class): bool`Compares two class instances for equality`factory``static factory(string $value): PluginClass`Automatically determines the correct subclass and instantiates it`values``static values(): array`*(abstract, defined in subclasses)* Returns all allowed values### Concrete PluginClass Subclasses

[](#concrete-pluginclass-subclasses)

ClassConstantsDescription`MacrosPluginClass``CLASS_EXPORTER`, `CLASS_HANDLER`, `CLASS_IMPORTER`Data processing macros: export, handle (transform), or import orders`LogisticPluginClass``CLASS_DELIVERY`, `CLASS_FULFILLMENT`Logistics: delivery carrier integration or end-to-end fulfillment`PbxPluginClass``CLASS_SIP`, `CLASS_WEBHOOK`Telephony: SIP protocol integration or webhook-based call tracking`ResalePluginClass``CLASS_RESALE`Resale / partner network integration### PluginEntity

[](#pluginentity)

Defines the data entity the plugin operates on. Extends `EnumHelper`.

MethodSignatureDescription`__construct``__construct(string $entity)`Creates an instance; throws `OutOfEnumException` if the value is invalid`get``get(): string`Returns the string value`isEquals``isEquals(?self $entity): bool`Compares two entity instances for equality`values``static values(): array`Returns `['UNSPECIFIED', 'ORDER']`ConstantValueDescription`ENTITY_ORDER``'ORDER'`Plugin operates on orders`ENTITY_UNSPECIFIED``'UNSPECIFIED'`Entity type is not specifiedUsage Examples
--------------

[](#usage-examples)

All examples below are taken from real production plugins.

### Macros handler plugin (order processing)

[](#macros-handler-plugin-order-processing)

From `plugin-macros-fields-filler-from-excel/bootstrap.php`:

```
use SalesRender\Plugin\Components\Purpose\MacrosPluginClass;
use SalesRender\Plugin\Components\Purpose\PluginEntity;
use SalesRender\Plugin\Components\Purpose\PluginPurpose;

$purpose = new PluginPurpose(
    new MacrosPluginClass(MacrosPluginClass::CLASS_HANDLER),
    new PluginEntity(PluginEntity::ENTITY_ORDER)
);
```

### Macros exporter plugin (data export)

[](#macros-exporter-plugin-data-export)

From `plugin-macros-excel/bootstrap.php`:

```
use SalesRender\Plugin\Components\Purpose\MacrosPluginClass;
use SalesRender\Plugin\Components\Purpose\PluginEntity;
use SalesRender\Plugin\Components\Purpose\PluginPurpose;

$purpose = new PluginPurpose(
    new MacrosPluginClass(MacrosPluginClass::CLASS_EXPORTER),
    new PluginEntity(PluginEntity::ENTITY_ORDER)
);
```

### Macros importer plugin (data import)

[](#macros-importer-plugin-data-import)

From `plugin-macros-importer-excel/bootstrap.php`:

```
use SalesRender\Plugin\Components\Purpose\MacrosPluginClass;
use SalesRender\Plugin\Components\Purpose\PluginEntity;
use SalesRender\Plugin\Components\Purpose\PluginPurpose;

$purpose = new PluginPurpose(
    new MacrosPluginClass(MacrosPluginClass::CLASS_IMPORTER),
    new PluginEntity(PluginEntity::ENTITY_ORDER)
);
```

### Logistic delivery plugin

[](#logistic-delivery-plugin)

From `plugin-logistic-bluedart/bootstrap.php` (note: this plugin passes purpose as an array to `Info::config`):

```
use SalesRender\Plugin\Components\Purpose\LogisticPluginClass;
use SalesRender\Plugin\Components\Purpose\PluginEntity;

Info::config(
    new PluginType(PluginType::LOGISTIC),
    fn() => 'BlueDart',
    fn() => 'Most-used eCommerce logistics and shipping software solution',
    [
        'class' => LogisticPluginClass::CLASS_DELIVERY,
        'entity' => PluginEntity::ENTITY_ORDER,
    ],
    new Developer('SalesRender', 'support@salesrender.com', 'salesrender.com')
);
```

### Logistic fulfillment plugin

[](#logistic-fulfillment-plugin)

From `plugin-logistic-dir/bootstrap.php`:

```
use SalesRender\Plugin\Components\Purpose\LogisticPluginClass;
use SalesRender\Plugin\Components\Purpose\PluginEntity;

[
    'class' => LogisticPluginClass::CLASS_FULFILLMENT,
    'entity' => PluginEntity::ENTITY_ORDER,
]
```

### PBX webhook plugin

[](#pbx-webhook-plugin)

From `plugin-pbx-sipsim/bootstrap.php`:

```
use SalesRender\Plugin\Components\Purpose\PbxPluginClass;
use SalesRender\Plugin\Components\Purpose\PluginEntity;

Info::config(
    new PluginType(PluginType::PBX),
    fn() => 'SipSim',
    fn() => 'SipSim telephony provider',
    [
        'class' => PbxPluginClass::CLASS_WEBHOOK,
        'entity' => PluginEntity::ENTITY_UNSPECIFIED,
    ],
    new Developer('SalesRender', 'support@salesrender.com', 'salesrender.com')
);
```

### Restoring purpose from serialized data

[](#restoring-purpose-from-serialized-data)

```
use SalesRender\Plugin\Components\Purpose\PluginPurpose;

$data = ['class' => 'HANDLER', 'entity' => 'ORDER'];
$purpose = PluginPurpose::factory($data);

// $purpose->getClass()->get()  === 'HANDLER'
// $purpose->getEntity()->get() === 'ORDER'
```

### Comparing purposes

[](#comparing-purposes)

```
$purposeA = new PluginPurpose(
    new MacrosPluginClass(MacrosPluginClass::CLASS_HANDLER),
    new PluginEntity(PluginEntity::ENTITY_ORDER)
);

$purposeB = PluginPurpose::factory(['class' => 'HANDLER', 'entity' => 'ORDER']);

$purposeA->isEquals($purposeB); // true
$purposeA->isEquals(null);      // false
```

API Reference
-------------

[](#api-reference)

### Namespace

[](#namespace)

```
SalesRender\Plugin\Components\Purpose

```

### All Constants Summary

[](#all-constants-summary)

ClassConstantValue`MacrosPluginClass``CLASS_EXPORTER``'EXPORTER'``MacrosPluginClass``CLASS_HANDLER``'HANDLER'``MacrosPluginClass``CLASS_IMPORTER``'IMPORTER'``LogisticPluginClass``CLASS_DELIVERY``'DELIVERY'``LogisticPluginClass``CLASS_FULFILLMENT``'FULFILLMENT'``PbxPluginClass``CLASS_SIP``'SIP'``PbxPluginClass``CLASS_WEBHOOK``'WEBHOOK'``ResalePluginClass``CLASS_RESALE``'RESALE'``PluginEntity``ENTITY_ORDER``'ORDER'``PluginEntity``ENTITY_UNSPECIFIED``'UNSPECIFIED'`### JSON Serialization

[](#json-serialization)

`PluginPurpose` implements `JsonSerializable`. The output format is:

```
{
    "class": "HANDLER",
    "entity": "ORDER"
}
```

Dependencies
------------

[](#dependencies)

PackageVersionPurpose`xakepehok/enum-helper`^0.1.0Base class for enum-like value objects with guard validationSee Also
--------

[](#see-also)

- [salesrender/plugin-component-form](https://github.com/SalesRender/plugin-component-form) -- form system used to configure plugin settings
- [salesrender/plugin-component-info](https://github.com/SalesRender/plugin-component-info) -- plugin metadata (name, description, developer); uses `PluginPurpose` in `Info::config()`
- [salesrender/plugin-component-settings](https://github.com/SalesRender/plugin-component-settings) -- settings persistence; stores form data submitted by users

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance61

Regular maintenance activity

Popularity16

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~141 days

Recently: every ~54 days

Total

14

Last Release

647d ago

Major Versions

1.3.3 → 2.0.02024-01-05

PHP version history (2 changes)1.0.0PHP &gt;=7.1.0

2.0.2PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6140af7bf37913fbad3d596efa1376ede23a55ac226a15b61857f4e58fc26c22?d=identicon)[SalesRender](/maintainers/SalesRender)

---

Top Contributors

[![XAKEPEHOK](https://avatars.githubusercontent.com/u/3051649?v=4)](https://github.com/XAKEPEHOK "XAKEPEHOK (3 commits)")[![disami115](https://avatars.githubusercontent.com/u/45440000?v=4)](https://github.com/disami115 "disami115 (1 commits)")[![IvanKalashnikov](https://avatars.githubusercontent.com/u/6877306?v=4)](https://github.com/IvanKalashnikov "IvanKalashnikov (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/salesrender-plugin-component-purpose/health.svg)

```
[![Health](https://phpackages.com/badges/salesrender-plugin-component-purpose/health.svg)](https://phpackages.com/packages/salesrender-plugin-component-purpose)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
