Download the PHP package dij-digital/langfuse-php without Composer
On this page you can find all versions of the php package dij-digital/langfuse-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dij-digital/langfuse-php
More information about dij-digital/langfuse-php
Files in dij-digital/langfuse-php
Informations about the package langfuse-php
Langfuse PHP - A PHP Client for Langfuse API
This package provides a wrapper around the Langfuse API, allowing you to easily integrate Langfuse into your PHP applications. It uses as few dependencies as possible.
This package supports the following features:
Prompts
- Get text prompts
- Get chat prompts
- Compile text prompts
- Compile chat prompts
- Create text prompts
- Create chat prompts
- List prompts (auto-paginated)
- Update prompt labels
- Fallback handling for prompt fetching errors
- Fallback handling when no prompt is found
Ingestion
- Create and update traces
- Create and update spans (with nesting)
- Create and update generations
- Automatic
traceIdandparentObservationIdthreading - Sends directly to the Langfuse v2 ingestion API
Scores
- Create scores
- Get scores
- List scores
- Delete scores
- V2 API support for scores
Install the package using Composer:
How to use this package
Setup
Prompts
Ingestion
Every call to trace(), span(), or generation() immediately sends a request to the Langfuse ingestion API. No buffering, no flushing required.
Trace
A trace is the root of an observation tree.
Span
Spans group related work within a trace. Create them from a Trace or another Span -- traceId and parentObservationId are set automatically.
Generation
Generations represent LLM calls. Create them from a Trace or Span -- context IDs are threaded automatically.
Full example
Scores
Architecture
Each trace(), span(), generation(), and update() call sends a request to the Langfuse POST /api/public/ingestion endpoint immediately.
Langfuse PHP was created by Tycho Engberink and is maintained by DIJ Digital under the MIT license.