# PHP SDK overview 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 the 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 commerce API, including the [Import API](/api/import-export/overview.md) by using the [Import API Request Builder](https://commercetools.github.io/commercetools-sdk-php-v2/docs/html/d7/da9/lib_2commercetools-import_2src_2_client_2_import_request_builder_8php_source.html). ## Get started Learn how to set up and use the PHP SDK with our [get started guide](/dev-tooling/php-sdk-getting-started.md). Refer to our [integration tests](https://github.com/commercetools/commercetools-sdk-php-v2/tree/master/test/integration/Api) for examples of creating, querying, updating, and deleting resources in your Project. The PHP SDK is open source and is available on [GitHub](https://github.com/commercetools/commercetools-sdk-php-v2) under the [MIT License](https://github.com/commercetools/commercetools-sdk-php-v2/blob/master/LICENSE), where you can also find its [release notes](https://github.com/commercetools/commercetools-sdk-php-v2/releases). You can view the full PHP SDK reference on [GitHub](https://commercetools.github.io/commercetools-sdk-php-v2/docs/html/index.html). ### Migration from v1 Learn how to migrate to the PHP v2 SDK by following our guide on [GitHub](https://github.com/commercetools/commercetools-sdk-php-v2/blob/master/Migration.md). ## SDK features The PHP SDK utilizes various standard interfaces and components to ensure consistency and interoperability: - [JSON serializer](https://www.php.net/manual/en/jsonserializable.jsonserialize.php) - [PSR-3 - LoggerInterface](https://www.php-fig.org/psr/psr-3/) - [PSR-4 - Autoloader](https://www.php-fig.org/psr/psr-4/) - [PSR-6 - CachingInterface](https://www.php-fig.org/psr/psr-6/) - [PSR-7 - HTTP Message Interface](https://www.php-fig.org/psr/psr-7/) - [PSR-16 - Common Interface for Caching Libraries](https://www.php-fig.org/psr/psr-16/) - [PSR-18 - HTTP Client](https://www.php-fig.org/psr/psr-18/) - PHP Date API: - [DateTimeImmutable](https://www.php.net/manual/en/datetimeimmutable.construct.php) The [PHP SDK reference](https://commercetools.github.io/commercetools-sdk-php-v2/docs/html/index.html) 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](https://github.com/commercetools/commercetools-sdk-php-v2/issues). If the issue is urgent or critical for your business, contact the [commercetools support team](https://support.commercetools.com/). 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 The PHP SDK uses exceptions from the base class Exception (such as [InvalidArgumentException](https://www.php.net/manual/en/class.invalidargumentexception.php)) and provides its own exceptions which inherit from [BaseException](https://github.com/commercetools/commercetools-sdk-php-v2/blob/master/lib/commercetools-base/src/Exception/BaseException.php). JSON serializing and deserializing problems throw [JsonException](https://www.php.net/manual/en/class.jsonexception.php). [ApiClientException](https://github.com/commercetools/commercetools-sdk-php-v2/blob/master/lib/commercetools-base/src/Exception/ApiClientException.php) expresses errors which can be recovered by the client (HTTP status code >= 400 and \< 500). [ApiServerException](https://github.com/commercetools/commercetools-sdk-php-v2/blob/master/lib/commercetools-base/src/Exception/ApiServerException.php) expresses errors which can be recovered by the server (HTTP status code >= 500). ### 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](/api/errors.md). ## Related pages - [Area overview page with navigation](/dev-tooling.md) - [Next page: Get started](/dev-tooling/php-sdk-getting-started.md)