Add rustalytics to your PHP app in under 5 minutes
Install via Composer:
composer require rustalytics/php
1. Initialize the tracker in your application:
// config.php or similar
require_once 'vendor/autoload.php';
use Rustalytics\Tracker;
$tracker = new Tracker([
'projectId' => 'your-project-id',
'apiKey' => 'your-api-key'
]);
2. Track page views automatically by adding this to your header:
<?php
// At the top of your template/header file
$tracker->pageView();
?>
3. Track custom events:
// Track a custom event
$tracker->track('signup_completed', [
'user_id' => $userId,
'plan' => 'premium'
]);
Check our Laravel integration guide for framework-specific setup.
For Symfony, use our bundle:
composer require rustalytics/symfony-bundle
Your rustalytics project ID (required)
Your rustalytics API key (required)
Custom API endpoint (optional)
If you need any help with the integration, feel free to: