dij-digital / langfuse-laravel
This is my package langfuse-laravel
Fund package maintenance!
DIJ Digital
Requires
- php: ^8.3||^8.4
- dij-digital/langfuse-php: dev-master
- illuminate/contracts: ^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-faker: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^2.0
- rector/rector: ^2.0
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.
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.