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\Shuttle→Nimbly\Shuttle\ShuttleShuttle\Handler\MockHandler→Nimbly\Shuttle\Handler\MockHandlerCapsule\Request→Nimbly\Capsule\RequestCapsule\Response→Nimbly\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: 0Apps: 5Automations: 1B2BSiteManagement: 0Bookings: 118Chat: 1CurrencyConverter: 2DomainConnect: 0DomainSearch: 1Ecom: 24EmailMarketing: 20Events: 63EventsGuests: 0EventsPolicies: 5Faq: 11Forum: 5LocalDelivery: 7Locations: 6LoyaltyAccounts: 8LoyaltyPrograms: 2LoyaltyRewards: 4Marketing: 2MarketingConsent: 8Members: 27Notifications: 0Oauth: 0OauthApp: 5Payments: 8Pricing: 0PricingPlans: 35Progallery: 9PromoteSeoTxtFileServer: 2RedirectSession: 1Resellers: 8Restaurants: 36SiteActions: 0SiteFolders: 6SiteList: 1SiteMedia: 24SiteProperties: 9SocialGroups: 24Stores: 82V1: 1WixData: 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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8.47k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-12