castledio / castled-php-sdk
Castled PHP 库
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-09-05 22:12:17 UTC
README
Castled PHP SDK 可以让您的 PHP 后端服务器将用户属性和事件传输到 Castled。这些数据可以作为活动或工作流的触发器,或者与您的数据仓库同步,以实现高级客户细分。以下步骤将指导您将 SDK 集成到您的 PHP 应用程序中。
SDK 安装
require_once __DIR__ . '/vendor/autoload.php'; composer require castledio/castled-php-sdk
SDK 初始化
Castled::init(<Your API Key>);
跟踪用户属性
Castled::identify([ 'userId' => '12345', 'traits' => [ 'plan' => 'basic', 'first_name' => 'John', 'last_name' => 'Taylor' ] ]);
跟踪用户事件
Castled::track([ 'event' => 'order_status_update', 'userId' => '12345', 'properties' => [ 'plan' => 'basic', 'order_id' => 'o1' ] ]);