naugrim / wortmann-soap-api
允许与Wortmann AG的API通信
0.4.0
2023-05-26 09:42 UTC
Requires
- php: ^8.0
- ext-libxml: *
- ext-soap: *
- guzzlehttp/guzzle: ^7.4
- illuminate/support: ^8.0|^9.0|^10.0
- phpro/soap-client: ^1.1|^2.1
Requires (Dev)
- laminas/laminas-code: ^4.0
- phpunit/phpunit: ^9.0
README
使用语义版本控制和git-flow。请针对develop
分支创建pull-requests。
安装
composer require naugrim/wortmann-soap-api
Laravel
包将自动发现。在您的.env
中设置WORTMANN_SOAP_API_USERNAME
和WORTMANN_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
。