castledio / castled-php-sdk
Castled PHP Library
v2.0.0
2024-02-05 15:39 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^0.7
- overtrue/phplint: ^3.0
- php-parallel-lint/php-parallel-lint: ^1.3
- phpunit/phpunit: ^11.0
- roave/security-advisories: dev-latest
- slevomat/coding-standard: ^7.0
- squizlabs/php_codesniffer: ^3.6
Suggests
- ext-curl: For using the curl HTTP client
- ext-zlib: For using compression
This package is auto-updated.
Last update: 2024-05-05 21:25:51 UTC
README
The Castled PHP SDK empowers your PHP-based backend servers to transmit user attributes and events to Castled. This data can serve as triggers for campaigns or workflows, or be synchronized with your data warehouse for advanced customer segmentation. The following steps will guide you through the process of integrating the SDK with your PHP application.
SDK Installation
require_once __DIR__ . '/vendor/autoload.php'; composer require castledio/castled-php-sdk
SDK Initialisation
Castled::init(<Your API Key>);
Track User Attributes
Castled::identify([ 'userId' => '12345', 'traits' => [ 'plan' => 'basic', 'first_name' => 'John', 'last_name' => 'Taylor' ] ]);
Track User Events
Castled::track([ 'event' => 'order_status_update', 'userId' => '12345', 'properties' => [ 'plan' => 'basic', 'order_id' => 'o1' ] ]);