patryk-sawicki/sprii-laravel
最新稳定版本:1.0.0
Composer 安装命令:
composer require patryk-sawicki/sprii-laravel
包简介
Sprii API client for laravel.
README 文档
README
Sprii API client for laravel.
Requirements
- PHP 8.2 or higher with json extensions.
Installation
The recommended way to install is through Composer.
composer require patryk-sawicki/sprii-laravel
Backend Usage
Add to env:
SPRII_API_KEY = 'your_key' SPRII_CACHE_DEFAULT_TTL = 86400 // optional - default 86400 seconds
Import class:
use PatrykSawicki\SpriiApi\app\Classes\Sprii;
Products
Send products to sprii.
Sprii::products()->send(array $data); // return bool.
Request:
$data = [ 'id' => '1', 'sku' => 'string', 'name' => 'string', 'price' => 0, 'description' => 'string', 'url' => 'string', 'type' => 'simple', 'status' => 'enabled', 'image' => 'string', 'alternativeImages' => [ 'string' ], 'inventory' => 0, 'manageStock' => true, 'configurableOptions' => [ [ 'id' => 0, 'name' => 'string', 'position' => 0, 'values' => [ 'string' ] ] ], 'variants' => [ [ 'id' => '2', 'sku' => 'string', 'name' => 'string', 'price' => 10, 'description' => 'string', 'url' => 'string', 'status' => 'enabled', 'image' => 'string', 'alternativeImages' => [ 'string' ], 'inventory' => 2, 'manageStock' => true, 'options' => [ [ 'id' => 0, 'value' => 'string' ] ] ] ], 'customAttributes' => 'string', 'defaultQuantityToAdd' => 0, 'test' => 0 ];
Result:
true // or false
Orders
Send
Send orders to sprii.
Sprii::orders()->send(array $data); // return bool.
Request:
$data = [ 'spriiOrderNumber' => '1', 'orderTotal' => 1, 'id' => '1', 'openForCheckout' => true, 'items' => [ [ 'product_id' => '2', 'quantity' => 1, 'sku' => 'string', 'custom_attributes' => 'string', 'unitPrice' => 1 ] ] ];
Result:
true // or false
Get order
Get order from sprii.
Sprii::orders()->get(string $id); // return object.
Request:
$id = '1';
Result:
object(stdClass)#1 (5) { ["order"] => object(stdClass)#2 (5) { ["id"] => string(1) "1" ["spriiOrderNumber"] => string(1) "1" ["orderTotal"] => int(1) ["openForCheckout"] => bool(true) ["items"] => array(1) { [0] => object(stdClass)#3 (5) { ["product_id"] => string(1) "2" ["quantity"] => int(1) ["sku"] => string(6) "string" ["custom_attributes"] => string(6) "string" ["unitPrice"] => int(1) } } } }
Changelog
Changelog is available here.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-13