定制 marktic/embeddable 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

marktic/embeddable

Composer 安装命令:

composer require marktic/embeddable

包简介

Embeddable widgets library for SaaS applications

README 文档

README

Embeddable widgets library for SaaS applications. Provides a framework for defining, configuring, and embedding iframe-based widgets in external sites.

Features

  • Define widgets as PHP classes with typed configurable properties
  • Auto-generate embed HTML (<iframe> + optional <script>)
  • Admin bundle with a widget builder UI (tabbed interface, customize form, live preview, copy-to-clipboard embed code)
  • Property types: TextProperty, NumberProperty, SelectProperty, CheckboxProperty

Installation

composer require marktic/embeddable

Usage

Define a Widget

use Marktic\Embeddable\Widgets\AbstractWidget;
use Marktic\Embeddable\WidgetProperties\TextProperty;
use Marktic\Embeddable\WidgetProperties\SelectProperty;

class MyWidget extends AbstractWidget
{
    public function getName(): string { return 'my-widget'; }
    public function getLabel(): string { return 'My Widget'; }

    public function getProperties(): array
    {
        return [
            new TextProperty('title', 'Title', 'Default Title'),
            new SelectProperty('theme', 'Theme', ['light' => 'Light', 'dark' => 'Dark'], 'light'),
        ];
    }

    protected function getBaseUrl(): string
    {
        return 'https://myapp.com/widgets/my-widget';
    }
}

Define a Widget Collection

use Marktic\Embeddable\Widgets\WidgetsCollection;

class MyWidgets extends WidgetsCollection
{
    protected static function widgetClasses(): array
    {
        return [
            'my-widget' => MyWidget::class,
        ];
    }
}

Get Embed HTML

$widget = new MyWidget();
echo $widget->getHtml();
// or with parameters:
echo $widget->getHtml(['theme' => 'dark', 'title' => 'Hello']);

Admin Bundle Controller

use Marktic\Embeddable\Bundle\Modules\Admin\Controllers\HasWidgetsControllerTrait;

class MyWidgetsController
{
    use HasWidgetsControllerTrait;

    protected function getWidgetsClass(): string
    {
        return MyWidgets::class;
    }
}

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固