commscenter / comms-php-sdk

Comms电商系统的PHP API

dev-master 2021-11-11 09:56 UTC

This package is auto-updated.

Last update: 2024-09-10 15:06:41 UTC


README

Comms PHP SDK 是一个可以帮助您管理 Comms 商店数据的工具。

用法

Pckg 框架

注册默认提供者 \CommsCenter\Provider\Comms,这样 Api 服务将自动解析。

use \CommsCenter\Provider\Comms // ... public function providers() { return [ // ... Comms::class, ]; } // ... $api = resolve(\CommsCenter\Comms\Api::class);

独立使用

实例化新的 \CommsCenter\Comms\Api 并提供 $endpoint$apiKey

$api = new \CommsCenter\Comms\Api::class

端点

浏览 /api/http-ql/definition 查看可用实体、字段和操作的列表。

商品

$offers = $api->offers()->getQuery()->where('dt_published', new Date(), '>=')->all(); $newOffer = $api->offers()->create(['title' => '我的新商品']); $api->offers()->where('id', 5)->one()->getQuery()->set('dt_published', new Date())->save();

更多

查看 comms-js-sdk 获取更多使用 JS 的示例。

import {offers} from "comms-js-sdk/entity/offers"; let allOffers = offers.all();