alex-nzr/bit-umc-sdk
Composer 安装命令:
composer require alex-nzr/bit-umc-sdk
包简介
PHP library for the typical BIT-UMC SOAP API
README 文档
README
Requirements
- PHP >= 8.1
- ext-soap
- ext-json
- ext-xmlreader
Version 2 API
The SDK is built around a single public entry point: ANZ\\BitUmc\\SDK\\BitUmcClient.
Principles
- Credentials and access data are passed at runtime.
- The SDK does not read
.env, ini files or databases. - Transport type is selected explicitly through
TransportType. - SOAP is implemented now.
- HTTP transport is reserved in the architecture for the next stage.
- SOAP XML responses are parsed through
XMLReaderto reduce peak memory usage on large payloads. - Successful calls return normalized arrays.
- Failures throw typed exceptions from
ANZ\\BitUmc\\SDK\\Domain\\Exception.
Usage
use ANZ\BitUmc\SDK\BitUmcClient; use ANZ\BitUmc\SDK\Transport\Auth\BasicAuth; use ANZ\BitUmc\SDK\Transport\ConnectionOptions; use ANZ\BitUmc\SDK\Transport\Protocol; use ANZ\BitUmc\SDK\Transport\TransportType; $client = new BitUmcClient( TransportType::SOAP, new ConnectionOptions( protocol: Protocol::HTTP, host: '127.0.0.1:3500', baseName: 'umc', auth: new BasicAuth('1cUser', '1cUserPassword'), apiKey: null, ) );
Available operations
$client->getClinics(); $client->getEmployees(); $client->getNomenclature($clinicUid); $client->getSchedule($scheduleQuery); $client->getAppointmentStatus($appointmentUid); $client->sendReserve($reserveRequest); $client->sendWaitList($waitListRequest); $client->sendAppointment($bookAppointmentRequest); $client->deleteAppointment($appointmentUid);
Request DTOs
ANZ\\BitUmc\\SDK\\Domain\\Request\\ScheduleQueryANZ\\BitUmc\\SDK\\Domain\\Request\\ReserveRequestANZ\\BitUmc\\SDK\\Domain\\Request\\WaitListRequestANZ\\BitUmc\\SDK\\Domain\\Request\\BookAppointmentRequest
See examples/index.php for a complete example.
Returned data
getClinics(): array
[
'f679444a-22b7-11df-8618-002618dcef2c' => [
'uid' => 'f679444a-22b7-11df-8618-002618dcef2c',
'name' => 'Центральная клиника',
],
'66abf7b4-2ff9-11df-8625-002618dcef2c' => [
'uid' => '66abf7b4-2ff9-11df-8625-002618dcef2c',
'name' => 'Третий центр',
],
]
getEmployees(): array
[
'2eb1f97b-6a3c-11e9-936d-1856809fe650' => [
'uid' => '2eb1f97b-6a3c-11e9-936d-1856809fe650',
'name' => 'Юрий',
'surname' => 'Безногов',
'middleName' => 'Сергеевич',
'fullName' => 'Безногов Юрий Сергеевич',
'clinicUid' => 'f679444a-22b7-11df-8618-002618dcef2c',
'photo' => 'base64_encoded_photo',
'description' => 'Краткое описание из 1С',
'rating' => '',
'specialtyName' => 'Офтальмология',
'specialtyUid' => '0j7rhngc0ldqu9gm0lzqvtc70l7qs9c40y8',
'services' => [
'5210c9dc-65a2-11e9-936d-1856809fe650' => [
'uid' => '5210c9dc-65a2-11e9-936d-1856809fe650',
'personalDuration' => 0,
],
],
],
]
getNomenclature(string $clinicUid): array
[
'a0230570-3ef7-11de-8086-001485c0d477' => [
'uid' => 'a0230570-3ef7-11de-8086-001485c0d477',
'name' => 'Массаж век',
'typeOfItem' => 'Услуга',
'artNumber' => '',
'price' => '160',
'duration' => 1800,
'measureUnit' => 'мин',
'parent' => '5210c9bf-65a2-11e9-936d-1856809fe650',
],
'a0230571-3ef7-11de-8086-001485c0d477' => [
'uid' => 'a0230571-3ef7-11de-8086-001485c0d477',
'name' => 'Гель для массажа',
'typeOfItem' => 'Материал',
'artNumber' => '101-55',
'price' => '100',
'duration' => 900,
'measureUnit' => 'мл',
'parent' => '00000000-0000-0000-0000-000000000000',
],
]
getSchedule(?ScheduleQuery $query = null): array
[
'f679444a-22b7-11df-8618-002618dcef2c' => [
'0j7rhngc0ldqu9gm0lzqvtc70l7qs9c40y8' => [
'ac30e13a-3087-11dc-8594-005056c00008' => [
'specialtyName' => 'Офтальмология',
'employeeName' => 'Барбышева Евгения Петровна',
'durationFrom1C' => '0001-01-01T00:15:00',
'durationInSeconds' => 900,
'timetable' => [
'freeFormatted' => [
'05-04-2026' => [
[
'typeOfTimeUid' => '624f2a40-5aa8-4f01-83f4-0f38535364bb',
'date' => '2026-04-05T00:00:00',
'timeBegin' => '2026-04-05T09:00:00',
'timeEnd' => '2026-04-05T09:15:00',
'formattedDate' => '05-04-2026',
'formattedTimeBegin' => '09:00',
'formattedTimeEnd' => '09:15',
],
],
],
],
],
],
],
]
getAppointmentStatus(string $appointmentUid): array
[
'statusId' => '6',
'statusTitle' => 'Резерв времени',
]
sendReserve(ReserveRequest $request): array
[
'uid' => '432a40a2-2ea3-11f1-9bf7-8fedb1ae9f50',
]
sendWaitList(WaitListRequest $request): array
[
'uid' => '432a40ab-2ea3-11f1-9bf7-8fedb1ae9f50',
]
sendAppointment(BookAppointmentRequest $request): array
[
'success' => true,
]
deleteAppointment(string $appointmentUid): array
[
'success' => true,
]
Error handling
use ANZ\BitUmc\SDK\Domain\Exception\BitUmcException; try { $clinics = $client->getClinics(); } catch (BitUmcException $e) { echo $e->getMessage(); }
Tests
What is covered
Current test suite covers these cases.
Unit and fixture-based tests:
- endpoint resolution
- request mapping for schedule, appointment status and appointment creation
- parsing of clinics
- parsing of employees and employee services
- parsing of nomenclature
- parsing of schedule
- parsing of common result payloads
- parsing of appointment status payloads
- SOAP response handling for:
OkError- plain text error responses
- XML responses with
ОписаниеОшибки
Live integration tests:
getClinics()getEmployees()- search for
Центральная клиника - search for doctor
Барбышева getNomenclature()for the central clinic with lookup ofПервичная консультация офтальмологаsendReserve()->getAppointmentStatus()->deleteAppointment()sendWaitList()sendAppointment()- negative transport cases:
- wrong base name
- wrong web-service name
How unit tests work
Unit tests do not connect to 1C.
They work on local fixtures from tests/Fixtures/soap.
These fixtures are raw XML or raw text responses captured from a real 1C test instance.
This means:
- unit tests are deterministic and fast
- parser behaviour is checked against real responses, not synthetic examples
- you do not need any runtime credentials to run unit tests
Run unit tests:
vendor/bin/phpunit --testsuite unit
How to refresh fixtures from a real 1C instance
Fixture capture script:
Before running it, set environment variables:
BIT_UMC_TEST_PROTOCOL=HTTPorHTTPSBIT_UMC_TEST_HOSTBIT_UMC_TEST_BASE_NAMEBIT_UMC_TEST_LOGINBIT_UMC_TEST_PASSWORD
Example PowerShell:
$env:BIT_UMC_TEST_PROTOCOL='HTTP' $env:BIT_UMC_TEST_HOST='example.com' $env:BIT_UMC_TEST_BASE_NAME='umc' $env:BIT_UMC_TEST_LOGIN='login' $env:BIT_UMC_TEST_PASSWORD='password' php tests/Tools/CaptureSoapFixtures.php
How to run integration tests against a real 1C instance
Integration tests use live network calls and require env variables.
Supported env variables:
BIT_UMC_RUN_INTEGRATION_TESTS=1BIT_UMC_TEST_PROTOCOL=HTTPorHTTPSBIT_UMC_TEST_HOSTBIT_UMC_TEST_BASE_NAMEBIT_UMC_TEST_LOGINBIT_UMC_TEST_PASSWORD
Example PowerShell:
$env:BIT_UMC_RUN_INTEGRATION_TESTS='1' $env:BIT_UMC_TEST_PROTOCOL='HTTP' $env:BIT_UMC_TEST_HOST='example.com' $env:BIT_UMC_TEST_BASE_NAME='umc' $env:BIT_UMC_TEST_LOGIN='login' $env:BIT_UMC_TEST_PASSWORD='password' vendor/bin/phpunit --testsuite integration
Important:
- integration tests assume that the target test base contains data similar to the fixtures used when they were written
- they are currently oriented on clinic
Центральная клиника, doctorБарбышеваand serviceПервичная консультация офтальмолога - on another base those exact entities may not exist, so tests that check for them may fail even if transport and parsing work correctly
- generic transport-negative tests can still be reused on any base
Transport notes
ConnectionOptions already reserves the apiKey field for the future HTTP transport. SOAP ignores this field.
alex-nzr/bit-umc-sdk 适用场景与选型建议
alex-nzr/bit-umc-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 68 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 08 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「soap」 「Bit-Umc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alex-nzr/bit-umc-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alex-nzr/bit-umc-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alex-nzr/bit-umc-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
cURL and cURL based Soap-Client for PHP
A PHP client for the Salesforce SOAP API
A PSR-7 compatible library for making CRUD API endpoints
A Yii2 component for working with TurboSMS.ua SOAP service
Zend Framework 1 Soap package
NuSOAP PHP library re-packaged for Packagist/Composer
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-09