承接 trstd/cot-integration-library 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

trstd/cot-integration-library

Composer 安装命令:

composer require trstd/cot-integration-library

包简介

A PHP integration library for connecting to Community of Trust platform.

README 文档

README

License CircleCI

This library provides a comprehensive PHP interface for integrating with the Community of Trust (COT) platform, facilitating seamless interactions with its services.

Requirements

  • PHP >= 7.4
  • Composer for managing dependencies

Installation

To install the library, run the following command in your project directory:

composer require trstd/cot-integration-library

Usage

Here is a basic example of how to use the library:

On the backend side:

<?php

require_once 'vendor/autoload.php';

use TRSTD\COT\Client;

// Initialize the client
$client = new Client(
    <CLIENT_ID>, // Client ID - e.g. 'cot-switch-X1234567890123456789012345678901'
    <CLIENT_SECRET>, // Client Secret - e.g. '1234567890123456789012345678901234567890123456789012345678901234'
    <AUTH_STORAGE_INSTANCE>, // It can be any storage option implementing AuthStorageInterface - e.g. new DatabaseAuthStorage()
    <ENV> // Environment (optional) - dev, qa, or prod, defaults to prod
);

// Invoke handleCallback function to handle code coming from the authentication server
$client->handleCallback();

// Get consumer data for the current user
$consumerData = $client->getConsumerData();

// Access consumer information
if ($consumerData) {
    $firstName = $consumerData->getFirstName();
    $membershipStatus = $consumerData->getMembershipStatus();
    $membershipSince = $consumerData->getMembershipSince();
}

On the frontend side, place the following code in your HTML file where you want the widget to appear:

<trstd-login tsId="X1234567890123456789012345678901"></trstd-login>
<script type="module" src="https://cdn.trstd-login.trstd.com/trstd-login/script.js"></script>

For more detailed examples, please refer to the examples/ directory.

Development

Prerequisites

  • PHP >= 7.4
  • Composer
  • Docker (optional, for containerized development)

Setup

  1. Install dependencies:

    composer install
  2. Generate certificates (for HTTPS testing):

    make certs
  3. Start development environment:

    make dev

Configuration

  1. Create configuration file:

    cp test-environment/config.example.php test-environment/config.php
  2. Update configuration with your credentials:

    <?php
    return [
         'tlciid' => 'YOUR_ACTUAL_TLCIID',
         'client_id' => 'YOUR_ACTUAL_CLIENT_ID',
         'client_secret' => 'YOUR_ACTUAL_CLIENT_SECRET',
         'environment' => 'qa'
    ];
    ?>

Development Commands

The project includes a comprehensive Makefile with the following commands:

🐳 Docker Environment

  • make dev - Start Docker with live file watching
  • make docker-stop - Stop Docker environment

🔐 Certificates

  • make certs - Generate self-signed localhost TLS certs for HTTPS (8443)

Testing

The project includes a test environment for development and testing:

  1. Start the test environment:

    make dev
  2. Access the test page:

  3. Run automated tests:

    make test

Debugging

For debugging with Xdebug:

  1. Start Xdebug in your IDE first (Cursor, VS Code, PhpStorm)

  2. Run development environment:

    make dev
  3. Set breakpoints in your PHP code

  4. Visit test page: https://localhost:8443/oauth-integration-test.php

  5. Code will pause at breakpoints for inspection

Important: Always start Xdebug in IDE before running make dev. The environment will attach to your IDE's debugger on host.docker.internal:9003.

Contributing

Contributions are welcome! Please refer to the CONTRIBUTING.md file for guidelines.

License

This library is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Versioning

This project adheres to Semantic Versioning. For the versions available, see the tags on this repository.

PHP Package Repository

This library is available on Packagist.

trstd/cot-integration-library 适用场景与选型建议

trstd/cot-integration-library 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 116 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 07 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「library」 「integration」 「trustedshops」 「cot」 「trstd」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 trstd/cot-integration-library 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 trstd/cot-integration-library 我们能提供哪些服务?
定制开发 / 二次开发

基于 trstd/cot-integration-library 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-08