PHPackages                             datarangersnew/datarangersnew - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. datarangersnew/datarangersnew

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

datarangersnew/datarangersnew
=============================

DataRangers服务端埋点PHP SDK

1.0.0(1y ago)010Apache-2.0PHP

Since May 20Pushed 1y agoCompare

[ Source](https://github.com/caoqiang1990/datarangers-sdk-php-7.4-before)[ Packagist](https://packagist.org/packages/datarangersnew/datarangersnew)[ RSS](/packages/datarangersnew-datarangersnew/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

DataRangers
===========

[](#datarangers)

项目背景
----

[](#项目背景)

datarangers-sdk-php是 [DataRangers](https://datarangers.com.cn/) 的用户行为采集服务端SDK。

服务端埋点支持在客户的服务端进行埋点采集和上报，作为客户端埋点的补充或替代，其支持的典型场景包括：

1. 客户端埋点+服务端埋点组合：该场景下，服务端埋点一般用来弥补客户端埋点覆盖不到的部分数据，是目前最常见的使用场景。
2. 纯服务端埋点：所有的埋点收集和上报都由服务端完成，需要的客户端数据则由服务端收集和提取后上报到DataRangers。

使用方法
----

[](#使用方法)

1. 新建一个Laravel项目
2. 在composer.json中添加如下字段

    ```
    {
    "require": {
            "datarangers/datarangers": "^1.0"
        }
    }
    ```
3. 执行命令

    ```
    composer require datarangers/datarangers
    ```
4. 首先加载配置项

    ```
    # 私有化部署场景 logagent模式
    CollectorConfig::init_datarangers_collector([
            "domain" => "http://domain",
            "save" => true,
            "headers" => [
                "Host" => "host",
                "Content-Type" => "application/json"
            ],
            "http_timeout"=> 10000
        ]);

    # 私有化部署场景 http 模式，Host 必须配置,Host 没有http://,https://
    CollectorConfig::init_datarangers_collector([
    "domain" => "https://xxxx",
    "save" => false,
    "headers" => [
        "Host" => "xxxx",
        "Content-Type" => "application/json"
    ],
    "http_timeout"=> 10000
    ]);

    # saas 云上环境
    CollectorConfig::init_datarangers_collector([
        "domain" => "https://xxxx",
        "save" => false,
        "headers" => [
            "Content-Type" => "application/json"
        ],
        "app_keys" => [
            1001 => getenv("APP_KEY")
        ],
        "openapi" => [
            "domain" => "https://xxxx",
            "ak" => getenv("OPENAPI_AK"),
            "sk" => getenv("OPENAPI_SK")
        ],
        "http_timeout"=> 10000
    ]);
    ```

    domain 配置说明：

    1. 私有化，请联系部署运维人员获取
    2. saas，根据接入的环境配置不同的地址：
        1. saas版本国内站：
        2. SaaS版国际站:
    3. SAAS 上如果上报 item 和用户属性，需要设置openapi：
        1. domain:
            1. SaaS版国内站:
            2. SaaS版国际站:
        2. ak/sk 请联系客户经理获取
5. 执行代码

    ```
    $rc = new AppEventCollector();
    $rc->sendEvent("uuid16980", 1001, null, [ProfileMethod::SET, "php_event"],
        [["php_name" => "php", "php_version" => "5.6"], ["php_name" => "php", "php_version" => "5.6"]]);

    $rc->profileSet("uuid16980", 1001,["php_name" => "php", "php_version" => "5.6"]);
    $rc->profileSetOnce("uuid16980", 1001,["php_name" => "php", "php_version" => "5.6"]);
    $rc->profileIncrement("uuid16980", 1001,["count" => 6]);
    $rc->profileAppend("uuid16980", 1001,["php_arr" => ["index1","index2"]]);

    # set item properties
    $rc->itemIdSet(getenv("APP_ID"), "book", "book3", ["author" => "吴承恩", "name" => "西游记", "price" => 59.90, "category" => 1]);
    $rc->itemIdSet(getenv("APP_ID"), "book", "book4", ["author" => "Guanzhong Luo", "name" => "SanGuoYanYi", "price" => 69.90, "category" => 1]);

    # 在事件中上报item
    $rc->sendEvent("test-uuidsdk1", getenv("APP_ID"), null, "php_single_event_with_item",
        ["php_name" => "php", "php_version" => "5.6"],
        [["item_name" => "book", "item_id" => "book3"], ["item_name" => "book", "item_id" => "book4"]]
    );
    ```

License
-------

[](#license)

Copyright 2020 Beijing Volcano Engine Technology Co., Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

722d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f8dfea3291ef7e5b656502189084d26f827376f18468c952339b769531b3ab25?d=identicon)[caoqiang](/maintainers/caoqiang)

---

Top Contributors

[![hTangle](https://avatars.githubusercontent.com/u/39337724?v=4)](https://github.com/hTangle "hTangle (30 commits)")[![zhangpengspin](https://avatars.githubusercontent.com/u/85116083?v=4)](https://github.com/zhangpengspin "zhangpengspin (22 commits)")[![caoqiang1990](https://avatars.githubusercontent.com/u/22781493?v=4)](https://github.com/caoqiang1990 "caoqiang1990 (4 commits)")[![easerene](https://avatars.githubusercontent.com/u/6889798?v=4)](https://github.com/easerene "easerene (1 commits)")

### Embed Badge

![Health badge](/badges/datarangersnew-datarangersnew/health.svg)

```
[![Health](https://phpackages.com/badges/datarangersnew-datarangersnew/health.svg)](https://phpackages.com/packages/datarangersnew-datarangersnew)
```

###  Alternatives

[nervo/yuicompressor

YUI Compressor is an open source tool that supports the compression of both JavaScript and CSS files. The JavaScript compression removes comments and white-spaces as well as obfuscates local variables using the smallest possible variable name. CSS compression is done using a regular-expression-based CSS minifier.

161.5M5](/packages/nervo-yuicompressor)[rmunate/laravel_helpers

Empower Your Laravel Journey: Unleash the Power of Helpers! Unlock a world of possibilities with our standard creation and seamless utilization of helpers within the Laravel framework. Our solution offers a simple, efficient, and elegant way to execute your application's custom methods from any class or view, making development a breeze. Supercharge your Laravel project and elevate your coding experience with our Helper Library.

552.8k](/packages/rmunate-laravel-helpers)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
