PHP
Software Development Kit for all PHP platforms
Introduction
The SDK is mostly generated from the OpenAPI specification. You can read the API documentation here: https://cloud.squidex.io/api/docs.
This means that the API is fully covered, including all endpoints used by the frontend. You can also use the SDK to create and configure Apps, schemas and rules.
Use this SDK in your PHP application to integrate with Squidex CMS.
Install the SDK
The SDK is available on packagist (compose). You can install it with:
Composer is a dependency manager for PHP: https://getcomposer.org/
Instantiate the SDK
The SquidexClient
is the main entry point for the SDK. It provides the properties for all endpoints.
You can instantiate the client using the following code snippet:
The host
parameter is optional if you are using Squidex Cloud.
Additional Configuration
In this article, we will cover some of the important configuration values only. Have a look at the source code for all available options: https://github.com/Squidex/sdk-php/blob/main/lib/Configuration.php
Timeout
Configure a timeout in seconds to cancel unresponsive requests.
The default timeout is 30 seconds.
Token Store
The SDK uses the client ID and the client secret to acquire a bearer token, and handles invalidation and expiration automatically. By default the token is stored inside the client and therefore a new token is acquired when the client is cleaned by the garbage collector. However, one can define where the token is stored.
Ignore Certificates
By default the certificates are validated. But for test environments it might be necessary to connect to instances with self signed certificates only. Therefore we have introduced an option to ignore the certificate chain:
Use the Client
To use the client you have to use the correct property.
For example, to create a schema use the schemas
property.
In order to work with contents, use the contents
property.
Error Handling
The SDK uses exceptions for error handling.
Refer to the code snippet below for an example:
Last updated