PHPackages                             kilden/laravel - 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. kilden/laravel

ActiveLibrary

kilden/laravel
==============

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

v0.1.0-alpha.6(1mo ago)0978↓70.9%MITPHPPHP &gt;=8.2CI passing

Since Jul 14Pushed 1mo agoCompare

[ Source](https://github.com/kildenhq/kilden-laravel)[ Packagist](https://packagist.org/packages/kilden/laravel)[ Docs](https://kilden.io)[ RSS](/packages/kilden-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

 [![Kilden PHP SDK](https://raw.githubusercontent.com/kildenhq/kilden-sdk-php/main/.github/assets/hero.png)](https://raw.githubusercontent.com/kildenhq/kilden-sdk-php/main/.github/assets/hero.png)

kilden/laravel
==============

[](#kildenlaravel)

[![Packagist](https://camo.githubusercontent.com/527deb3bb6a3d8cce843a911e15bdbbebbea165259212c15a2490ffbd82514a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b696c64656e2f6c61726176656c)](https://packagist.org/packages/kilden/laravel)[![license](https://camo.githubusercontent.com/3dbf2ddfd891b8abeb548f8126b664017a776ae7d692ec0f34f8a195154be11a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b696c64656e2f6c61726176656c)](LICENSE)

[Kilden](https://kilden.io) is a customer data platform — analytics, campaigns and session replay on one event pipeline. This package wraps the [PHP SDK](https://github.com/kildenhq/kilden-sdk-php) 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`](https://github.com/kildenhq/kilden-sdk-php) directly.

Install
-------

[](#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
-------------------

[](#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.

Frontend in one line
--------------------

[](#frontend-in-one-line)

`@kildenScript` renders the official web SDK loader in your layout — configured, identity-wired, and auto-identifying the logged-in user:

```

    ...
    @kildenScript

```

```
KILDEN_PUBLIC_WRITE_KEY=wk_...   # the PUBLIC key — never sk_ in a view
```

If your marketing site and your app live on different subdomains (`example.com` + `app.example.com`), one more env var makes the visitor survive the crossing — the anonymous id moves into a cookie both hosts can read, and first-touch attribution rides along:

```
KILDEN_COOKIE_DOMAIN=.example.com
```

Heads-up: this turns on cookies, which can affect your cookie-consent obligations — that is why it is off by default.

If the identity route below is registered, the snippet wires the SDK's `getIdentityToken` to it automatically, so browser events come out **verified** with zero extra code. The wiring resolves the route by name (`kilden.identity`), so a custom path — `KildenRoutes::identity('/api/kilden-token')`— is picked up without further configuration. Without `KILDEN_PUBLIC_WRITE_KEY`(or with `KILDEN_ENABLED=false`) the directive renders nothing.

Identity verification
---------------------

[](#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
-------------

[](#feature-flags)

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

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

Testing
-------

[](#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
---------------------

[](#about-this-repository)

Read-only subtree split of [`kilden-sdk-php/packages/laravel`](https://github.com/kildenhq/kilden-sdk-php/tree/main/packages/laravel)— issues and pull requests go there. Behavior is governed by the [server SDK spec](https://github.com/kildenhq/kilden-sdk-spec).

- [kilden.io/docs](https://kilden.io/docs)
- [Discussions](https://github.com/kildenhq/kilden-sdk-php/discussions)

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance91

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Every ~1 days

Total

5

Last Release

44d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12437201?v=4)[freshwork](/maintainers/freshwork)[@freshwork](https://github.com/freshwork)

---

Top Contributors

[![gdespirito](https://avatars.githubusercontent.com/u/1103494?v=4)](https://github.com/gdespirito "gdespirito (14 commits)")

---

Tags

laravelanalyticsfeature-flagsCDPkilden

### Embed Badge

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

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.1k6.4M360](/packages/laravel-ai)[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

6036.2k](/packages/erag-laravel-lang-sync-inertia)[api-platform/laravel

API Platform support for Laravel

58190.1k22](/packages/api-platform-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)[spatie/laravel-flare

Send Laravel errors to Flare

131.8M8](/packages/spatie-laravel-flare)

PHPackages © 2026

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