rudderstack/rudder-php-sdk
Composer 安装命令:
composer require rudderstack/rudder-php-sdk
包简介
RudderStack Analytics SDK PHP library
README 文档
README
RudderStack is a customer data pipeline tool for collecting, routing and processing data from your websites, apps, cloud tools, and data warehouse.
More information on RudderStack can be found here.
Getting Started with PHP SDK
Install rudder-php-sdk using composer
git clone https://github.com/rudderlabs/rudder-php-sdk /my/app/folders/
Initialize the Client
use Rudder\Rudder;
require_once realpath(__DIR__ . '/vendor/autoload.php');
Rudder::init(WRITE_KEY, array(
"data_plane_url" => DATA_PLANE_URL,
"consumer" => "lib_curl",
"debug" => true,
"max_queue_size" => 10000,
"flush_at" => 100
));
SDK Initialization options
Below parameters are optional and can be passed during SDK initialization.
| Name | Type | Default value | Description |
|---|---|---|---|
consumer |
String | lib_curl |
To explicitly mark which consumer to use. |
data_plane_url |
String | hosted.rudderlabs.com |
The data plane URL. |
debug |
Boolean | false |
Whether to log messages and wait for a response. Makes any queuing consumers non-async, defaults to false. This will make the library block until a response has been received from the API, so it is not recommended for production use. |
ssl |
Boolean | true |
Whether to use SSL for the connection. |
tls |
String | false |
Whether to use TLS instead of SSL for the socket connection. |
error_handler |
Function | function ($code, $message) {} |
A handler which will be called on errors to aid in debugging. A function to handle errors, particularly useful for debugging. Note that if debug mode is not specified, then the error_handler will only be called on connection level errors and timeouts. |
max_queue_size |
Number | 10000 |
The max number of items in the queue . |
flush_at |
Number | 100 |
How many items to send in a single curl request . |
timeout |
Number | 0.5 |
The number of seconds to wait for the socket request to time out . |
filename |
String | /tmp/analytics.log |
The location to write the log file when file consumer is selected. |
compress_request |
Boolean | true |
Whether to use gzipped request payloads. This is supported for server versions 1.4.0 and above. |
flush_inteval |
Number | 10000 |
Frequency in milliseconds to send data using flush method execution. |
curl_timeout |
Number | 0 (infinite) |
Set timeout for the curl connections. |
curl_connecttimeout |
Number | 300 |
Set connect timeout for the curl connections. |
max_item_size_bytes |
Number | 32000 |
Set maximum message item size in bytes. |
max_queue_size_bytes |
Number | 512000 |
Set maximum batch size in bytes. |
filepermissions |
Number | 0644 |
Set the file permissions for file consumer. |
Send Events
Rudder::track(array(
"userId" => "f4ca124298",
"event" => "Signed Up",
"properties" => array(
"plan" => "Enterprise"
)
));
Acknowledgements
This project is a fork of analytics-php by [segmentio].
Contact Us
If you come across any issues while configuring or using this SDK, feel free to start a conversation on our Slack channel. We will be happy to help you.
rudderstack/rudder-php-sdk 适用场景与选型建议
rudderstack/rudder-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.55M 次下载、GitHub Stars 达 8, 最近一次更新时间为 2021 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「analytics」 「rudder」 「rudderstack」 「rudderanalytics.js」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rudderstack/rudder-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rudderstack/rudder-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rudderstack/rudder-php-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Analytics chooser extensions for site settings.
A Laravel Nova Card to show Fathom Analytics stats.
Laravel 5 package to retrieve Google Analytics data.
Scout Extended extends Laravel Scout adding algolia-specific features
PHP library for Bluelabs Erwin
A PHP & WordPress library for sending analytics data to WP Power Analytics
统计信息
- 总下载量: 1.55M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 13
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-26