承接 kilden/laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kilden/laravel

Composer 安装命令:

composer require kilden/laravel

包简介

Kilden for Laravel — server-side events, queued delivery and the /kilden/identity endpoint.

README 文档

README

Kilden PHP SDK

kilden/laravel

Packagist license

Kilden is a customer data platform — analytics, campaigns and session replay on one event pipeline. This package wraps the PHP SDK for Laravel: a configured singleton, a facade, queued delivery, and the identity endpoint your frontend needs for identity verification.

Requires PHP 8.2+ and Laravel 11–13. For plain PHP (7.4+), use kilden/kilden-php directly.

Install

composer require kilden/laravel:@alpha kilden/kilden-php:@alpha

(Both @alpha flags are needed while we ship prereleases — Composer ignores stability flags on transitive requirements. They go away at 0.1.0.)

php artisan vendor:publish --tag=kilden-config

Set your secret write key — never the public wk_ one, which belongs in the browser SDK:

KILDEN_WRITE_KEY=sk_...

Track from anywhere

use Kilden\Laravel\Facades\Kilden;

Kilden::track($user->id, 'order_completed', ['revenue' => 99.9, 'currency' => 'CLP']);
Kilden::identify($user->id, ['plan' => 'pro', 'email' => $user->email]);

Events flush automatically at the end of the request (and on queue workers, when the job finishes). With KILDEN_QUEUE=true, calls dispatch a job instead of sending inline — the timestamp is stamped at call time, so nothing shifts.

Identity verification

The browser SDK can prove who its events belong to — but only your backend can sign that proof. One route makes it work:

// routes/web.php
use Kilden\Laravel\KildenRoutes;

KildenRoutes::identity();   // POST /kilden/identity, behind your auth middleware
KILDEN_IDENTITY_SECRET=...   # from your Kilden project settings
KILDEN_IDENTITY_KID=k1

The route signs a short-lived token for auth()->user() and returns { distinct_id, token, traits } — the web SDK refreshes against it automatically. To attach signed traits:

KildenRoutes::traitsUsing(fn ($user) => ['plan' => $user->plan]);

Only ever sign the authenticated user. Signing an id taken from request input lets anyone impersonate anyone — with a "verified" stamp on top.

Feature flags

if (Kilden::isEnabled('new_checkout', $user->id, ['default' => false])) {
    // ...
}

$variant = Kilden::getFeatureFlag('pricing_test', $user->id, [
    'person_properties' => ['plan' => $user->plan],
]);

Testing

use Kilden\Laravel\Facades\Kilden;

Kilden::fake();

// ... run code that tracks ...

Kilden::assertTracked('order_completed');
Kilden::assertNothingTracked();

With KILDEN_WRITE_KEY unset (or KILDEN_ENABLED=false) the client is a silent no-op, so test and local environments need no configuration at all.

About this repository

Read-only subtree split of kilden-sdk-php/packages/laravel — issues and pull requests go there. Behavior is governed by the server SDK spec.

License

MIT

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固