dij-digital/langfuse-laravel

This is my package langfuse-laravel

dev-main 2025-06-25 14:20 UTC

This package is auto-updated.

Last update: 2025-06-25 14:20:40 UTC


README

This package provides a wrapper around the langfuse-php package, allowing you to easily integrate Langfuse into your Laravel applications. It uses as few dependencies as possible.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

It supports the following features:

  • Getting a text prompt
  • Getting a chat prompt
  • Compiling a text prompt
  • Compiling a chat prompt
  • Create a text prompt
  • Create a chat prompt
  • Fallbacks for prompt fetching when an error occurs
  • Fallbacks for prompt fetching when no prompt is found

Requires PHP 8.4

⚡️ Install the package using Composer:

composer require dij-digital/langfuse-laravel  

🤙 Modern codebase , refactoring and static analysis in one command

composer codestyle  

🚀 Run the entire test suite:

composer test  

How to use this package

Add the following env keys to your projects .env file:

LANGFUSE_BASE_URI=https://cloud.langfuse.com
LANGFUSE_PUBLIC_KEY=
LANGFUSE_SECRET_KEY=
use DIJ\Langfuse\Laravel\Facades\Langfuse;

Langfuse::prompt()->text('promptName')->compile(['key' => 'value']);
Langfuse::prompt()->text('promptName')->compile(['key' => 'value']);
Langfuse::prompt()->chat('chatName')->compile(['key' => 'value']);
Langfuse::prompt()->list();
Langfuse::prompt()->create('promptName', 'text', PromptType::TEXT);

Langfuse Laravel was created by Tycho Engberink under the MIT license.