chkltlabs/wix-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

chkltlabs/wix-client

Composer 安装命令:

composer require chkltlabs/wix-client

包简介

A fluent interface for the Wix API

README 文档

README

PHP implementation of Wix API as an SDK.

Installation

composer require chkltlabs/wix-client

Requires PHP 8.2+.

Upgrading to 1.0

Version 1.0 drops support for nimbly/shuttle 0.x, psr/http-message 1.x, and PHP versions below 8.2 to align with Laravel 13.

If you inject a custom HTTP client, no code changes are required. If you reference Shuttle or Capsule classes directly, update imports:

  • Shuttle\ShuttleNimbly\Shuttle\Shuttle
  • Shuttle\Handler\MockHandlerNimbly\Shuttle\Handler\MockHandler
  • Capsule\RequestNimbly\Capsule\Request
  • Capsule\ResponseNimbly\Capsule\Response

Shuttle 2.x no longer accepts a configuration array in its constructor; pass dependencies as named constructor arguments instead.

Continuous Integration

GitHub Actions runs the full PHPUnit suite on PHP 8.2, 8.3, and 8.4. PHP 8.2 also runs with --prefer-lowest to verify compatibility with minimum allowed dependency versions.

Local Testing with Docker

To run tests with pinned versions (without relying on host PHP/composer), use Docker:

docker compose up -d --build
docker compose exec wix-client composer install
docker compose exec wix-client ./vendor/bin/phpunit

To stop the container:

docker compose down

Usage

The use of this package is intentionally extremely basic, methods have no required inputs except where required by the underlying Wix API. Please see Wix API Docs for more information.

This package has only been tested using API Keys. Please see the Roadmap below for planned features.

To begin, instantiate the Wix class. Depending on the endpoints you plan to access, you may set one of account_id/site_id as a blank string (but not both).

use Chkltlabs\WixClient\Wix;

$api = new Wix(api_key: $my_api_key, account_id: $my_account_id, site_id: $my_site_id);

Now you have a class-based accessor to various api resources. These resources are treated as properties on the Wix class, or as properties of those properties:

//get all posts on the site's blog
$response = $api->blog->posts->list();

This structure aims to replicate the Wix API Docs as closely as possible.

For endpoints that do not yet have dedicated resource methods, use explicit domain resources:

//members domain
$response = $api->members->get('v1/members', ['limit' => 100]);
$response = $api->members->listMembersV1Members([], ['limit' => 100]);

//ecom domain
$response = $api->ecom->post('v1/orders/query', ['query' => []]);
$response = $api->ecom->getOrder(['id' => $orderId]);

//site actions domain
$response = $api->site_actions->post('v1/site-actions', ['action' => []]);
$response = $api->site_actions->bulkDeleteSite([], ['siteIds' => [$siteId]]);

Regenerate typed domain operation methods from Wix public docs:

python3 tools/generate_typed_resources.py --docs-root /tmp/wix-rest-docs

Typed Resource Coverage Snapshot

Generated from public docs currently available in wix-incubator/wix-rest-docs:

  • Api: 0
  • Apps: 5
  • Automations: 1
  • B2BSiteManagement: 0
  • Bookings: 118
  • Chat: 1
  • CurrencyConverter: 2
  • DomainConnect: 0
  • DomainSearch: 1
  • Ecom: 24
  • EmailMarketing: 20
  • Events: 63
  • EventsGuests: 0
  • EventsPolicies: 5
  • Faq: 11
  • Forum: 5
  • LocalDelivery: 7
  • Locations: 6
  • LoyaltyAccounts: 8
  • LoyaltyPrograms: 2
  • LoyaltyRewards: 4
  • Marketing: 2
  • MarketingConsent: 8
  • Members: 27
  • Notifications: 0
  • Oauth: 0
  • OauthApp: 5
  • Payments: 8
  • Pricing: 0
  • PricingPlans: 35
  • Progallery: 9
  • PromoteSeoTxtFileServer: 2
  • RedirectSession: 1
  • Resellers: 8
  • Restaurants: 36
  • SiteActions: 0
  • SiteFolders: 6
  • SiteList: 1
  • SiteMedia: 24
  • SiteProperties: 9
  • SocialGroups: 24
  • Stores: 82
  • V1: 1
  • WixData: 44

Explicit Resource Status

All top-level domain resources in src/Resources are now explicit custom classes extending AbstractResource (no remaining top-level Domain subclasses).

Roadmap

Implemented

  • Blog
    • Categories
    • Drafts
    • Posts
    • Tags
  • Business
    • Location
    • Properties
  • Comments
  • Contacts
    • Bulk
    • ExtendedFields
    • Facets
    • Labels
  • Coupons
    • Bulk
  • Inbox
    • Conversations
    • Messages

Upcoming

  • Marketing
  • Media
  • Members
  • Site Content
  • Automations
  • Bookings
  • Chat
  • Data
  • Events
  • Forms
  • Forum
  • Groups
  • Notifications
  • Class method -> Route Documentation

Not Planned

  • Cashier
  • eCommerce
  • Loyalty Program
  • Payments
  • Pricing Plans
  • Restaurants
  • Stores
  • Payment Provider SPI
  • Account Management

Contributing

The Package uses a unified request system built on AbstractResource, so contributing new endpoints is as simple as creating a new class in src/Resources, and creating further subclasses is as simple as creating a new directory that matches your class name, and adding the HasCachedResources trait to your parent class. Make sure each extends AbstractResource.

Example from Blog.php:

//src/Resources/Blog.php
<?php

namespace Chkltlabs\WixClient\Resources;

use Chkltlabs\WixClient\Traits\HasCachedResources;

class Blog extends AbstractResource
{
    use HasCachedResources;
}

//src/Resources/Blog/Posts.php
<?php

namespace Chkltlabs\WixClient\Resources\Blog;

use Chkltlabs\WixClient\Resources\AbstractResource;

class Posts extends AbstractResource
{
    public function list(array $params = []): object
    {
      //...
    }
  //...
}

Credit && Thanks

This package is heavily inspired and influenced by the excellent (TomorrowIdeas/Plaid)[https://github.com/TomorrowIdeas/plaid-sdk-php] SDK implementation. Go show them some love!

chkltlabs/wix-client 适用场景与选型建议

chkltlabs/wix-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.47k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 10 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 chkltlabs/wix-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 chkltlabs/wix-client 我们能提供哪些服务?
定制开发 / 二次开发

基于 chkltlabs/wix-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 8.47k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-12