atabix / swretail-api-client
SWRetail API 的 PHP 客户端
0.5.8
2022-06-01 06:23 UTC
Requires
- php: >=7.1.3
- guzzlehttp/guzzle: ^6.3
- nesbot/carbon: ^1.36|^2.10
Requires (Dev)
- phpunit/phpunit: ^7.1.5
- vlucas/phpdotenv: ^3.1
README
本软件包提供 SW-Retail 云 API 的 PHP 客户端。
有关获取 SW-Retail 账户的信息,请访问 https://www.swretail.nl/(荷兰语)。
一些代码示例
示例:获取文章,并更新它。
<?php use SWRetail\Models\Article; $article = Article::get(15); echo $article->getDescription(); echo $article->priceInfo()->getBase(); $article->setAdditionalInfo('Lorem ipsum dolor sid amet.'); $article->update();
示例:创建订单
<?php use SWRetail\Models\Article; use SWRetail\Models\Article\Barcode; use SWRetail\Models\Order; use SWRetail\Models\Order\Line; use SWRetail\Models\Relation; use SWRetail\Models\Type\Price; $relation = Relation::byCode('K100123'); $order = new Order('87654'); $order->setStatus('created') ->setDate('2019-01-28') ->setShipTo($relation) ->setShippingCost(new Price('4.95')) ->setInvoiceTo($relation) ->setPaymentMethod('iDeal'); // Set some more properties, see example doc. $order->addLine(Line::fromArticle(Article::get(15))); $order->addLine(Line::fromBarcode(new Barcode('2637485960'))); $orderId = $order->create();
此存储库的 docs/examples/
目录中提供了许多示例。
安装
使用 composer,只需这样
composer require atabix/swretail-api-client
配置
当使用 Laravel 时,将 config/swretail.php
复制到您的项目配置中。请参阅该文件以获取关于您所需的 .env
值的详细信息。
SWRETAIL_ENDPOINT= SWRETAIL_USERNAME= SWRETAIL_PASSWORD=