Download the PHP package baldie81/woocommerce-sdk without Composer

On this page you can find all versions of the php package baldie81/woocommerce-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package woocommerce-sdk

WooCommerce PHP SDK

A small, framework-independent PHP client for the WooCommerce REST API (v3). No WordPress/Laravel/Symfony coupling — just PHP 8.1+ and Guzzle. It wraps the endpoints you actually reach for when integrating a store:

It also gives you fluent value-object builders (ProductInput, VariationInput, OrderInput, LineItem, Address, CustomerInput, CouponInput, CategoryInput, MetaData, BatchPayload) that every write method accepts interchangeably with plain arrays, a fluent Query builder for list endpoints, typed enums (ProductStatus, ProductType, CatalogVisibility, StockStatus, OrderStatus, DiscountType), and a clean exception hierarchy instead of leaking Guzzle exceptions.

Scope: this targets the standard WooCommerce core REST API (wc/v3). Endpoints added by extensions (subscriptions, bookings, …) are out of scope, though their custom fields pass straight through via meta_data and the set() escape hatches.

Install

Quick start

Authentication

Create a consumer key / consumer secret pair under WooCommerce → Settings → Advanced → REST API. Over HTTPS the SDK sends them as HTTP Basic auth, which is all WooCommerce needs.

TLS verification is on by default; pass verifySsl: false only for local/self-signed environments.

For a non-SSL store (local dev), WooCommerce can't use Basic auth, so set queryStringAuth: true to send the credentials as query parameters instead. Don't do this over plain HTTP in production — it exposes the credentials in URLs and logs.

Value objects (or arrays)

Every write method accepts either a fluent builder or a raw array, so you can opt into type-safety without giving up the array escape hatch. The builders all implement Arrayable:

Money is a string in WooCommerce. The builders' price setters accept a string or a number and stringify it for you (->regularPrice(19.9)"19.9").

A variable product carries its variations separately:

Orders

Listing & pagination

Build list queries with Query; list() returns one page, all() walks every page for you.

WooCommerce reports totals in the X-WP-Total / X-WP-TotalPages response headers (not the body) and caps per_page at 100. all() reads those headers and paginates until the last page, so you never silently truncate a large result set:

Batch API

Most collections expose a /batch endpoint that creates, updates and deletes in one round-trip. BatchPayload builds it; the SDK splits payloads larger than WooCommerce's 100-operation limit into several requests and merges the results:

Deleting

delete() permanently deletes by default (force: true) — required for resources that can't be trashed (customers, webhooks) and usually what an integration wants. Pass force: false to move a product/order to the trash instead:

Errors

Every failure is a WooCommerceException. Two concrete types:

Custom transport

Need retries, logging or your own middleware? Build a Guzzle client yourself and hand it over — its base_uri must point at the store root and the API prefix is prepended to every path:

Examples

Copy-pasteable usage lives in examples/one class per area, each method demonstrating a single operation against the real API. Build a client with ExampleClient::create() (edit its dummy placeholder credentials first — never commit real keys), then call a class, e.g. (new ProductExamples($woo))->create().

Testing

The suite drives the client against a Guzzle MockHandler, so it makes no real HTTP calls.

License

MIT — see LICENSE.


All versions of woocommerce-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^7.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package baldie81/woocommerce-sdk contains the following files

Loading the files please wait ...