web-atypique/cegid-y2-sdk-php8

CEGID / Y2 - SDK - PHP8

1.0.0 2024-03-21 16:52 UTC

This package is auto-updated.

Last update: 2024-09-21 17:47:26 UTC


README

https://github.com/pgrimaud/cegid-y2-sdk 分支而来

消耗 CEGID/Y2 的 SOAP API。

要求

  • PHP >= 8.1
  • 包 php-soap (ext-soap 扩展)

安装

composer require web-atypique/cegid-y2-sdk-php8

基本使用

Hello world

<?php

use Y2\ItemInventory\HelloWorld;
use Y2\ItemInventory\ItemInventoryWcfService;
use Y2\ItemInventory\RetailContext;

$wsdl     = ''; // WSDL interface
$login    = ''; // credentials for basic auth
$password = ''; // credentials for basic auth
$dbId     = ''; // Y2 database ID

$retailContext = new RetailContext();
$retailContext->setDatabaseId($dbId);
$helloWorld = new HelloWorld('ZZZ', $retailContext);

try {
    $client = new ItemInventoryWcfService($wsdl, [
        'login'    => $login,
        'password' => $password
    ]);

    $call = $client->HelloWorld($helloWorld)->getHelloWorldResult();

    print_r($call);

} catch (SoapFault $e) {
    echo "SOAP ERROR CALL : " . $e->getMessage() . "\n";
}

许可证

在 MIT 许可证的条款下授权。