PHP SDK overview

Elevate, May 20-22-2025, Miami Beach, Florida

Build commerce applications with PHP.

The PHP SDK (also referred to as the PHP v2 SDK) enables you to use methods and objects to interact with Composable Commerce APIs rather than using plain HTTP calls and untyped JSON objects. With the PHP SDK, you can make use of IDE autocompletion, type-safety, encapsulation, and an internal domain-specific language for formulating valid requests.

The PHP SDK supports every Composable Commerce API, including the Import API by using the Import API Request Builder.

Get started

Learn how to set up and use the PHP SDK with our get started guide.
You can view the full PHP SDK reference on GitHub.

Migration from v1

SDK features

The PHP SDK utilizes various standard interfaces and components to ensure consistency and interoperability:

The PHP SDK reference includes example usage of these interfaces and components.

The SDK also simplifies development with:

  • Client interfaces: the HTTP client abstract is a functional interface, and you can replace it with test doubles.
  • Model factory methods: each model has a factory method ::of() to create a new empty instance.

Best practices and error handling

If you encounter an issue using the PHP SDK, please report it in the GitHub repository. If the issue is urgent or critical for your business, contact the Composable Commerce support team. You should provide as many details as possible with your issue reports, including the SDK version, specific error messages, any log or stack traces, and the code snippet that causes the issue.

Exceptions

Errors

If the PHP SDK cannot run a command due to unfulfilled preconditions, one error response with multiple errors can be returned. For more information, see HTTP API Errors.