PHP code example of kilden / laravel

1. Go to this page and download the library: Download kilden/laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kilden / laravel example snippets


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]);

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

KildenRoutes::identity();   // POST /kilden/identity, behind your auth middleware

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

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

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

use Kilden\Laravel\Facades\Kilden;

Kilden::fake();

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

Kilden::assertTracked('order_completed');
Kilden::assertNothingTracked();
sh
php artisan vendor:publish --tag=kilden-config