定制 think.studio/laravel-myriad-soap 二次开发

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

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

think.studio/laravel-myriad-soap

最新稳定版本:1.4.0

Composer 安装命令:

composer require think.studio/laravel-myriad-soap

包简介

Unofficial web integration with Myriad 5.1

README 文档

README

Packagist License Packagist Version Total Downloads Build Status Code Coverage Scrutinizer Code Quality

Unofficial web integration with Myriad 5.1

Installation

You can install the package via composer:

composer require think.studio/laravel-myriad-soap

php artisan vendor:publish --provider="MyriadSoap\ServiceProvider" --tag="config"

Usage

Direct call via facade:

$result = MyriadSoap::SOAP_getContactCommunications(['Contact_ID' => 1234]);
/*
    [
     "ContactCommunication" => [
       "123456;12;01234 567 890;Yes",
       "123457;14;me@test.co.uk;No",
     ],
    ]
*/

By default, Myriad lists responses has unexpected string lists responses, that why will be useful helper:

MyriadSoap::SOAP_getContactCommunications_List(['Contact_ID' => 1234], 3, 'ContactCommunication' /* Optional, as appropriate key, app will try guess itself */);

Or convert response to collection:

MyriadSoap::SOAP_getContactCommunications_Collection(['Contact_ID' => 1234], [
        'ContactCommunication_ID' => fn($i) => (int) $i,
        'DespatchType_ID' => fn($i) => (int) $i,
        'ContactCommunication',
        'PrimaryUse'              => fn($i) => $i == 'Yes',
    ], 'ContactCommunication' /* Optional, as appropriate key, app will try guess itself */);

To fetch not strings lists use AssocCollection call:

MyriadSoap::SOAP_getOrderPackageTypes_AssocCollection([], [
            'OrderPackageType_ID' => fn($i) => (int) tap($i, fn() => throw_if(! is_numeric($i), UnexpectedTypeException::class)),
            'OrderPackageType' => fn($i) => (string) $i,
            'OrderPackageCategory',
        ], 'OrderPackageType' /* Optional, as appropriate key, app will try guess itself */);

Using feature sets that allow you to wrap your own business logic (each class should extends FunctionsSet)

use MyriadSoap\Endpoints\FunctionsSet;

class MyContactFunctions extends FunctionsSet {

    public function getContactCommunications( int $customerNumber ) {
        return $this->api->call(
            'SOAP_getContactCommunications',
            [
                'Contact_ID' => $customerNumber,
            ]
        );
    }
}

$result =  MyriadSoap::functionsSet(MyContactFunctions::class)->getContactCommunications(1234);

Credits

  • Think Studio

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-11