byjg/soap-server 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

byjg/soap-server

Composer 安装命令:

composer require byjg/soap-server

包简介

A lightweight and modern SOAP server implementation for PHP 8.3+

README 文档

README

sidebar_key soap-server
tags
php http

Soap Server

A lightweight and modern SOAP server implementation for PHP 8.3+

Sponsor Build Status Opensource ByJG GitHub source GitHub license GitHub release

Features

  • 🚀 Modern PHP 8.3+ Attributes: Use PHP attributes to define SOAP services declaratively
  • 📝 Auto-generated WSDL: Automatic WSDL generation from your service definitions
  • 🎨 Beautiful Documentation UI: Modern, interactive HTML documentation with Jinja templates
  • 🔧 Flexible Configuration: Support for both attribute-based and programmatic configuration
  • 📊 Type Safety: Full support for complex types, arrays, and optional parameters
  • 🌐 SOAP 1.1 & 1.2: Support for both SOAP versions
  • 🎯 Discovery Support: Built-in DISCO (Discovery) document generation
  • 📱 Responsive Design: Mobile-friendly service documentation interface

Installation

composer require byjg/soap-server

Quick Start

Using PHP Attributes (Recommended)

<?php

use ByJG\SoapServer\Attributes\{SoapService, SoapOperation, SoapParameter};
use ByJG\SoapServer\SoapAttributeParser;
use ByJG\SoapServer\ResponseWriter;

#[SoapService(
    serviceName: 'CalculatorService',
    namespace: 'http://example.com/calculator',
    description: 'A simple calculator web service'
)]
class Calculator
{
    #[SoapOperation(description: 'Adds two numbers together')]
    public function add(
        #[SoapParameter(description: 'First number')] int $a,
        #[SoapParameter(description: 'Second number')] int $b
    ): int {
        return $a + $b;
    }

    #[SoapOperation(description: 'Subtracts second from first')]
    public function subtract(int $a, int $b): int
    {
        return $a - $b;
    }
}

// Start the service
$handler = SoapAttributeParser::parse(Calculator::class);
$response = $handler->handle();
ResponseWriter::output($response);

Using Programmatic Configuration

<?php

use ByJG\SoapServer\{SoapHandler, SoapOperationConfig, SoapParameterConfig, SoapType};
use ByJG\SoapServer\ResponseWriter;

$addOperation = new SoapOperationConfig();
$addOperation->description = 'Adds two numbers';
$addOperation->args = [
    new SoapParameterConfig('a', SoapType::Integer),
    new SoapParameterConfig('b', SoapType::Integer)
];
$addOperation->returnType = SoapType::Integer;
$addOperation->executor = function(array $params) {
    return $params['a'] + $params['b'];
};

$handler = new SoapHandler(
    soapItems: ['add' => $addOperation],
    serviceName: 'CalculatorService'
);
$response = $handler->handle();
ResponseWriter::output($response);

Running the Service

Start PHP's built-in web server:

php -S localhost:8080 calculator.php

Then access:

Running Tests

composer install
composer test

Running Static Analysis

composer psalm

Documentation

Comprehensive documentation is available:

License and Acknowledgments

This project is licensed under the MIT License.

Note: Parts of this codebase were derived from an older PHP class originally licensed under the PHP License. The original code has been modernized and adapted for this project. For detailed information about the licensing and acknowledgments, see License Acknowledgments.

Dependencies

flowchart TD
    byjg/soap-server --> byjg/jinja-php
    byjg/soap-server --> byjg/webrequest
    byjg/soap-server --> byjg/serializer
Loading

Open source ByJG

byjg/soap-server 适用场景与选型建议

byjg/soap-server 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 68 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 11 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 byjg/soap-server 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-03