Download the PHP package salesrender/plugin-component-purpose without Composer

On this page you can find all versions of the php package salesrender/plugin-component-purpose. 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 plugin-component-purpose

salesrender/plugin-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

Requirements

Requirement Version
PHP >= 7.4.0
ext-json *
xakepehok/enum-helper ^0.1.0

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:

Key Classes

PluginPurpose

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

Method Signature Description
__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)

Abstract base for all plugin class categories. Extends EnumHelper.

Method Signature Description
__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

Class Constants Description
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

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

Method Signature Description
__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']
Constant Value Description
ENTITY_ORDER 'ORDER' Plugin operates on orders
ENTITY_UNSPECIFIED 'UNSPECIFIED' Entity type is not specified

Usage Examples

All examples below are taken from real production plugins.

Macros handler plugin (order processing)

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

Macros exporter plugin (data export)

From plugin-macros-excel/bootstrap.php:

Macros importer plugin (data import)

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

Logistic delivery plugin

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

Logistic fulfillment plugin

From plugin-logistic-dir/bootstrap.php:

PBX webhook plugin

From plugin-pbx-sipsim/bootstrap.php:

Restoring purpose from serialized data

Comparing purposes

API Reference

Namespace

All Constants Summary

Class Constant Value
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

PluginPurpose implements JsonSerializable. The output format is:

Dependencies

Package Version Purpose
xakepehok/enum-helper ^0.1.0 Base class for enum-like value objects with guard validation

See Also


All versions of plugin-component-purpose with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
ext-json Version *
xakepehok/enum-helper Version ^0.1.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 salesrender/plugin-component-purpose contains the following files

Loading the files please wait ...