Skip to content
Snippets Groups Projects

LangFuse

This module integrates the LangFuse PHP SDK with Drupal, providing observability and analytics for AI applications.

Requirements

  • Drupal 8.9, 9, 10 or 11
  • PHP 8.1 or higher
  • LangFuse account / Self-hosted LangFuse is fine too.

Installation

composer require drupal/langfuse

Configuration

  1. Navigate to /admin/config/langfuse/settings
  2. Enter your LangFuse credentials
  3. Select your preferred authentication method
  4. Save the configuration

Usage

Once configured, the module automatically tracks AI operations using the LangFuse SDK.

For custom implementations, use the LangFuse client service:

$langfuse_client = \Drupal::service('langfuse.client');
$trace = $langfuse_client->createTrace('my-trace');