naugrim/wortmann-soap-api

允许与Wortmann AG的API通信

0.4.0 2023-05-26 09:42 UTC

This package is auto-updated.

Last update: 2024-09-26 12:40:51 UTC


README

使用语义版本控制git-flow。请针对develop分支创建pull-requests。

安装

composer require naugrim/wortmann-soap-api

Laravel

包将自动发现。在您的.env中设置WORTMANN_SOAP_API_USERNAMEWORTMANN_SOAP_API_PASSWORD

可选:使用以下命令发布配置文件

php artisan vendor:publish --provider='Naugrim\WortmannSoapApi\Provider\WortmannSoapApiProv'

用法

Laravel

可以将API客户端的实例注入到您的Controller中(例如)

<?php

use Naugrim\WortmannSoapApi\Client\Type\GetStockAndPriceInformationByProductIds;
use Naugrim\WortmannSoapApi\Contracts\WortmannSoapApi;

class MyController {

    /**
     * @var WortmannSoapApi
     */
    protected $client;

    /**
     * @param WortmannSoapApi $client
     */
    public function __construct(WortmannSoapApi $client)
    {
        $this->client = $client;
    }

    public function getStockInformation(array $productIds)
    {
        $response = $this->client->request(
            GetStockAndPriceInformationByProductIds::class,
            [6466010, 6466011]
        );
        
        // do something with the response
        dump($response->entry());
    }
}

独立

demo/index.php