PHPackages                             salesrender/plugin-core-integration - 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. salesrender/plugin-core-integration

ActiveLibrary

salesrender/plugin-core-integration
===================================

SalesRender plugin integration core

0.1.0(2y ago)054—0%proprietaryPHPPHP &gt;=7.4.0

Since Nov 14Pushed 3mo ago2 watchersCompare

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

READMEChangelogDependencies (1)Versions (3)Used By (0)

Plugin Core Integration
=======================

[](#plugin-core-integration)

> Type-specific core framework for SalesRender integration plugins

Overview
--------

[](#overview)

`salesrender/plugin-core-integration` is a lightweight core package for building **INTEGRATION** type plugins on the SalesRender platform. Integration plugins receive data from external services (websites, landing pages, third-party platforms) and create orders in SalesRender via its GraphQL API.

Unlike macros plugins, integration plugins do **not** have batch processing or bulk order handling. They focus on:

- Providing a settings form for configuring how incoming data maps to SalesRender orders
- Exposing custom HTTP endpoints (actions) that accept webhooks or API calls from external systems
- Translating incoming data into SalesRender order creation requests

This package extends the base `salesrender/plugin-core` by providing its own `WebAppFactory` and `ConsoleAppFactory`classes. Since integration plugins have no batch processing, the factories are thin wrappers that simply delegate to the parent implementations without adding any extra routes or commands. All the customization is done by the plugin developer via custom Slim routes added after `$factory->build()`.

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

[](#installation)

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

**Requirements:**

- PHP &gt;= 7.4
- Extensions: `ext-json`

**Dependencies:**

- `salesrender/plugin-core` ^0.4.0

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

[](#architecture)

### How This Core Extends plugin-core

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

`plugin-core-integration` provides two factory classes in the `SalesRender\Plugin\Core\Integration\Factories` namespace:

#### WebAppFactory

[](#webappfactory)

```
namespace SalesRender\Plugin\Core\Integration\Factories;

class WebAppFactory extends \SalesRender\Plugin\Core\Factories\WebAppFactory
{
    public function build(): App
    {
        return parent::build();
    }
}
```

The integration `WebAppFactory` adds **no additional routes** beyond what the base `plugin-core` provides. It is a direct pass-through to the parent. The developer adds custom webhook routes after calling `$factory->build()`.

Available methods inherited from the parent:

- `addCors(string $origin = '*', string $headers = '*')` -- enable CORS headers (useful for receiving webhooks from browsers)
- `addBatchActions()` -- not typically used for integration plugins
- `addSpecialRequestAction(SpecialRequestAction $action)` -- add a special request handler

#### ConsoleAppFactory

[](#consoleappfactory)

```
namespace SalesRender\Plugin\Core\Integration\Factories;

class ConsoleAppFactory extends \SalesRender\Plugin\Core\Factories\ConsoleAppFactory
{
    public function build(): Application
    {
        return parent::build();
    }
}
```

The integration `ConsoleAppFactory` adds **no additional commands** beyond the base set. Since integration plugins do not have batch processing, no batch commands are registered.

### What the Base plugin-core Provides

[](#what-the-base-plugin-core-provides)

The base `plugin-core` framework (inherited by this package) provides:

**HTTP Routes (from WebAppFactory):**

MethodPathDescription`GET``/info`Returns plugin metadata`PUT``/registration`Registers the plugin for a company`GET``/robots.txt`Blocks search engine indexing`GET``/protected/forms/settings`Returns the settings form definition`GET``/protected/data/settings`Returns current settings data`PUT``/protected/data/settings`Saves settings data`GET``/protected/autocomplete/{name}`Autocomplete suggestions`GET``/protected/preview/table/{name}`Table preview data`GET``/protected/preview/markdown/{name}`Markdown preview`POST``/protected/upload`File upload**CLI Commands (from ConsoleAppFactory):**

CommandDescription`cron:run`Runs scheduled cron tasks`directory:clean`Cleans temporary directories`db:create-tables`Creates required database tables`db:clean-tables`Cleans old records from tables`lang:add`Adds a new language`lang:update`Updates translation files`specialRequest:queue`Processes special request queue`specialRequest:handle`Handles a single special request### What the Developer Must Implement

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

1. **Settings Form** -- a class extending `SalesRender\Plugin\Components\Form\Form` that defines plugin configuration fields
2. **Custom Action(s)** -- one or more classes implementing `SalesRender\Plugin\Core\Actions\ActionInterface` that handle incoming webhooks/requests and create orders via the SalesRender API
3. **bootstrap.php** -- configuration file that wires everything together

Getting Started: Creating an Integration Plugin
-----------------------------------------------

[](#getting-started-creating-an-integration-plugin)

### Step 1: Project Setup

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

```
mkdir my-integration-plugin && cd my-integration-plugin
composer init --name="myvendor/my-integration-plugin" --type="project"
composer require salesrender/plugin-core-integration
```

Set up PSR-4 autoloading in `composer.json`:

```
{
  "autoload": {
    "psr-4": {
      "MyVendor\\Plugin\\Instance\\Integration\\": "src/"
    }
  }
}
```

Create the project directory structure:

```
mkdir -p src/Actions src/Forms db public runtime
```

### Step 2: Bootstrap Configuration

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

Create `bootstrap.php` in the project root:

```
