定制 ucp-php-sdk/symfony-bundle 二次开发

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

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

ucp-php-sdk/symfony-bundle

Composer 安装命令:

composer require ucp-php-sdk/symfony-bundle

包简介

Symfony bundle for the UCP PHP SDK

README 文档

README

This package exposes the core SDK through Symfony services and HTTP endpoints.

Package name: ucp-php-sdk/symfony-bundle

It contains:

  • bundle registration and configuration
  • routes and controllers for discovery, catalog, cart, checkout, tokenization, OAuth, order read, A2A, and embedded surfaces
  • request-context and idempotency listeners
  • protocol JSON mapping
  • default storage adapters based on Doctrine DBAL
  • signing key and storage cleanup console commands

How To Use It

Use this package when the host app is Symfony and you want the SDK wired into HTTP endpoints quickly.

Install:

composer require ucp-php-sdk/symfony-bundle:^0.0.1

The default bundle stack gives you:

  • runtime config resolution
  • request signing and replay protection
  • profile building and discovery signing keys
  • idempotency handling
  • cached remote platform-profile fetches

Basic bundle config:

$container->extension('ucp_sdk', [
    'base_uri' => 'https://merchant.example',
    'allowed_profile_hosts' => ['merchant.example'],
    'allowed_agent_domains' => ['merchant.example'],
    'profile_fetching_development_mode' => false,
    'signature_policy' => 'log',
    'transports' => ['rest', 'a2a', 'embedded'],
    'enabled_capabilities' => [
        'dev.ucp.shopping.catalog',
        'dev.ucp.shopping.cart',
    ],
    'transport_endpoints' => [
        'a2a' => 'https://merchant.example/ucp/a2a',
        'embedded' => 'https://merchant.example/ucp/embedded',
    ],
    'storage' => [
        'dsn' => 'sqlite:///%kernel.project_dir%/var/ucp_sdk.sqlite',
    ],
]);

Valid signature_policy values are off, log, and strict. Valid transports values are rest, mcp, a2a, and embedded; REST is the default. enabled_capabilities is an allowlist of capability descriptor names; the default empty list keeps every registered capability enabled. When mcp is enabled, transport_endpoints.mcp is required because the shared SDK advertises MCP metadata only and does not provide a default /ucp/mcp runtime endpoint. Remote profile fetching is default-deny until allowed_profile_hosts is configured. Set profile_fetching_development_mode to true only for localhost/plain-HTTP development.

Storage Schema

The default DBAL repositories do not install or migrate tables automatically. If you use the bundled DBAL storage adapter, call the schema bootstrapper from your install, update, deployment, or startup lifecycle before handling UCP traffic:

use Ucp\Sdk\Symfony\Bridge\DoctrineDbal\SchemaBootstrapper;

final readonly class InstallUcpStorage
{
    public function __construct(private SchemaBootstrapper $bootstrapper)
    {
    }

    public function __invoke(): void
    {
        $this->bootstrapper->ensureSchema();
    }
}

SchemaBootstrapper::ensureSchema() is idempotent and updates only SDK-owned tables. It leaves unrelated application tables untouched.

Replace the default storage adapter by binding repository interfaces to your own services.

The default DBAL-backed repositories are only storage adapters for SDK state. They are not the required integration model for Shopware or any other platform.

The bundle runtime classes are part of the dead-code QA scope. Coverage and internal reference checks focus on bridge code, listeners, commands, controllers, and the realistic merchant example instead of the exported SDK contracts.

For service tags, config shape, and replacement rules, see AGENTS.md.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固