Woocommerce REST API 客户端

v0.0.3 2023-01-02 11:35 UTC

This package is auto-updated.

Last update: 2024-09-24 14:26:54 UTC


README

安装

composer require shreejalmaharjan-27/wooclient

用法

需要 composer 自动加载文件和加载类文件

use Shreejalmaharjan27\Wooclient\Category;
use Shreejalmaharjan27\Wooclient\Product;
use Shreejalmaharjan27\Wooclient\WooClient;


require __DIR__.'/vendor/autoload.php';

创建 WooClient 对象(网站地址末尾带斜杠)

$wooclient = new WooClient("ck_xxxxx,"cs_xxxxx","https://wordpress.example.com/");

创建一个产品

$product = new Product($wooclient);
$product->create(name: 'Example Product', price: 18.00, image: 'https://example.com/image.jpg');

创建一个产品类别

$category = new Category($wooclient);
$category->create(name: 'Example category');