Download the PHP package klaviyo/php-sdk without Composer
On this page you can find all versions of the php package klaviyo/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download klaviyo/php-sdk
More information about klaviyo/php-sdk
Files in klaviyo/php-sdk
Package php-sdk
Short Description Klaviyo PHP SDK
License Apache-2.0
Homepage http://github.com/klaviyo
Informations about the package php-sdk
php-klaviyo - RETIRED
Deprecation Notice
This SDK and its associated pip package are set to be deprecated on 2024-06-30 and will not receive further updates.
We recommend migrating over to our newest SDK.
You can read more about our SDK release history and support here
For a comparison between our old and new APIs, check out this guide.
Migration Instructions
NOTE: this change is not backwards compatible; migrating to the new SDK requires completing the following steps:
Install New SDK
composer require klaviyo/sdk
Update Import
From:
To:
Update Client Instantiation
From:
To:
Updating SDK Calls
The new SDK has many changes to namespace (resource and function names), parameters (names, types, and format), and error handling. Additionally, the new SDK sticks to just standard/built-in PHP types (int, string, array, etc), and does not make use of custom Models, as this legacy one does. Please reference this section of the new SDK repo for details on how to update each operation.
Multistore limitation
The new SDK currently sets API keys at a global environment level. This means that if you manage multiple stores, each store's client must be running in a different environment. We plan to update this behavior to better support multistore applications.
What is Klaviyo?
Klaviyo is a real-time service for understanding your customers by aggregating all your customer data, identifying important groups of customers and then taking action. http://www.klaviyo.com/
What does this package do?
- Track customers and events directly from your backend.
How to install?
composer require klaviyo/php-sdk
API Examples
After installing the Klaviyo package you can initiate it using your public token which is for track events or identifying profiles and/or your private api key to utilize the metrics and list apis.
You can then easily use Klaviyo to track events or identify people. Note, track and identify requests take your public token.
Track an event
You can also add profile properties to the 'customer properties' attribute in the Event model
or just add a property to someone
You can get metrics, a timeline of events and export analytics for a metric. See here for more https://www.klaviyo.com/docs/api/metrics
You can create, update, read, and delete lists. See here for more information https://www.klaviyo.com/docs/api/v2/lists
You can fetch profile information given the profile ID, See here for more information https://www.klaviyo.com/docs/api/people
You can request a privacy-compliant profile deletion given an identifying property
Exceptions
Klaviyo\Exception\KlaviyoApiException
Thrown when there is an issue making an API request. After you catch this exception, you can use getMessage() and it will return a string containing more details about the issue that occurred.
Klaviyo\Exception\KlaviyoRateLimitException
If a rate limit happens it will throw a Klaviyo\Exception\KlaviyoRateLimitException.
After you catch this exception you can use getMessage() and it will return a JSON encoded array:
{"detail":"Request was throttled. Expected available in 26.0 seconds.","retryAfter":26}
Klaviyo\Exception\KlaviyoAuthenticationException
Thrown when there is an authentication error when making an API request, usually caused by an invalid API key.
Klaviyo\Exception\KlaviyoResourceNotFoundException
Thrown when the system attempts to update a property that doesn't exist. For example, attempting to update a list that doesn't exist on the account.
All versions of php-sdk with dependencies
ext-json Version *
ext-curl Version *