Download the PHP package salesrender/plugin-component-info without Composer
On this page you can find all versions of the php package salesrender/plugin-component-info. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download salesrender/plugin-component-info
More information about salesrender/plugin-component-info
Files in salesrender/plugin-component-info
Package plugin-component-info
Short Description SalesRender plugin information component
License proprietary
Informations about the package plugin-component-info
salesrender/plugin-component-info
Plugin metadata container for the SalesRender plugin ecosystem, providing structured information about the plugin's type, name, description, and developer.
Overview
plugin-component-info is a core component required by every SalesRender plugin. It stores and exposes the metadata that identifies a plugin within the SalesRender platform: what type of plugin it is, what it does, who developed it, and any additional type-specific configuration.
The component is built around three key classes: Info (a singleton that holds the complete plugin metadata), PluginType (an enum-like class defining the supported plugin categories), and Developer (a value object with the developer's contact information). Together, they produce the JSON response served by the plugin's /info endpoint, which the SalesRender platform uses to register and display the plugin.
Both name and description fields support callable values, enabling dynamic content that can be resolved at runtime -- for example, to provide localized text via a translation component.
Installation
Requirements
- PHP >= 7.4
- Extensions:
ext-json - Dependencies:
xakepehok/enum-helper^0.1.0 -- enum value validation
Key Classes
Info
Namespace: SalesRender\Plugin\Components\Info
Singleton class that holds the complete plugin metadata. Configured once during bootstrap via the static config() method, then accessed via getInstance(). Implements JsonSerializable for direct JSON output.
Static methods:
| Method | Signature | Description |
|---|---|---|
config |
static config(PluginType $type, string\|callable $name, string\|callable $description, array\|JsonSerializable $extra, Developer $developer): void |
Configure the singleton instance with all plugin metadata |
getInstance |
static getInstance(): self |
Get the configured singleton. Throws RuntimeException if not configured |
Instance methods:
| Method | Signature | Description |
|---|---|---|
getType |
getType(): PluginType |
Get the plugin type |
getName |
getName(): string |
Get the plugin name (resolves callable if provided) |
getDescription |
getDescription(): string |
Get the plugin description (resolves callable if provided) |
getExtra |
getExtra(): array\|JsonSerializable\|mixed |
Get the extra metadata (type-specific configuration) |
getDeveloper |
getDeveloper(): Developer |
Get the developer information |
jsonSerialize |
jsonSerialize(): array |
Serialize to JSON (includes name, description, type, extra, languages, developer) |
config() parameter details:
| Parameter | Type | Description |
|---|---|---|
$type |
PluginType |
Plugin category (MACROS, LOGISTIC, PBX, CHAT, etc.) |
$name |
string\|callable |
Plugin display name. If callable, it is invoked when getName() is called |
$description |
string\|callable |
Plugin description (supports Markdown). If callable, it is invoked when getDescription() is called |
$extra |
array\|JsonSerializable |
Type-specific metadata (e.g., plugin class, entity, currency, capabilities) |
$developer |
Developer |
Developer contact information |
Validation:
$nameand$descriptionmust be non-empty strings or callables. AnInvalidArgumentExceptionis thrown if the value is empty or of an invalid type.$extramust be an array or implementJsonSerializable. AnInvalidArgumentExceptionis thrown otherwise.
PluginType
Namespace: SalesRender\Plugin\Components\Info
Enum-like class (extends EnumHelper) representing the supported plugin categories in the SalesRender platform.
Constants:
| Constant | Value | Description |
|---|---|---|
PluginType::MACROS |
'MACROS' |
Macro/batch processing plugins |
PluginType::LOGISTIC |
'LOGISTIC' |
Logistics and delivery plugins |
PluginType::PBX |
'PBX' |
Telephony/PBX integration plugins |
PluginType::CHAT |
'CHAT' |
Chat/messaging plugins |
PluginType::GEOCODER |
'GEOCODER' |
Geocoding plugins |
PluginType::INTEGRATION |
'INTEGRATION' |
Third-party integration plugins |
Constructor:
Throws an exception if the provided type is not one of the valid values.
Methods:
| Method | Signature | Description |
|---|---|---|
get |
get(): string |
Get the type value as a string |
values |
static values(): array |
Get all valid type values |
__toString |
__toString(): string |
String representation of the type |
Developer
Namespace: SalesRender\Plugin\Components\Info
Immutable value object containing the plugin developer's contact information. Implements JsonSerializable.
Constructor:
| Parameter | Type | Description |
|---|---|---|
$name |
string |
Developer or company name |
$email |
string |
Support email address for this plugin |
$hostname |
string\|null |
Developer's website hostname (without http:// or https://, e.g., "example.com") |
Validation:
$hostnamemust be a valid domain name without protocol or slashes. AnInvalidArgumentExceptionis thrown if the format is invalid.
Methods:
| Method | Signature | Description |
|---|---|---|
getName |
getName(): string |
Get the developer name |
getEmail |
getEmail(): string |
Get the support email (lowercased) |
getHostname |
getHostname(): string |
Get the website hostname |
jsonSerialize |
jsonSerialize(): array |
Serialize to JSON array |
Usage
Basic Configuration
Configure the plugin info in your bootstrap.php:
Using Callables for Localized Names
Use callables for $name and $description to support runtime localization via the translations component:
Chat Plugin with Capabilities
For chat plugins, the $extra array typically describes messaging capabilities:
PBX Plugin Configuration
Accessing Plugin Info at Runtime
JSON Output Structure
When serialized to JSON (as returned by the /info endpoint), the output has the following structure:
Configuration
The Info component is configured once during the plugin bootstrap phase, typically in bootstrap.php. The config() static method must be called before any access to getInstance().
Configuration order in bootstrap.php:
- Configure the database connection (
Connector::config(...)) - Configure the translator (
Translator::config(...)) - Configure plugin info (
Info::config(...)) - Configure settings, forms, and other components
API Reference
Info
PluginType
Valid values: MACROS, LOGISTIC, PBX, CHAT, GEOCODER, INTEGRATION, RESALE
Developer
Dependencies
| Package | Version | Purpose |
|---|---|---|
xakepehok/enum-helper |
^0.1.0 | Enum validation for PluginType values |
Dev dependencies:
| Package | Version | Purpose |
|---|---|---|
salesrender/plugin-component-translations |
^0.1.2 | Used in tests for verifying localization support |
See Also
salesrender/plugin-component-translations-- translation component used with callable$name/$descriptionsalesrender/plugin-component-purpose--PluginPurpose,PluginEntity, and plugin class definitions often used as$extrasalesrender/plugin-component-settings-- plugin settings, typically configured afterInfo