Download the PHP package uodev/langfuse-logger without Composer

On this page you can find all versions of the php package uodev/langfuse-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package langfuse-logger

Langfuse Logger for PHP

Latest Stable Version Tests License PHP Version Require

A lightweight PHP library to log your LLM API calls to Langfuse for observability and analytics.

Supported Providers

Provider Class Models
OpenAI OpenAIProvider GPT-4, GPT-4o, o1, o3-mini, etc.
Anthropic AnthropicProvider Claude 3.5 Sonnet, Claude 3 Opus, etc.
Google GoogleProvider Gemini 1.5 Pro, Gemini 2.0, etc.
xAI XAIProvider Grok-2, Grok-2 mini, etc.

Installation

Quick Start

Provider Examples

OpenAI

Anthropic (Claude)

Google (Gemini)

xAI (Grok)

Requirements

Features

Configuration

Get your Langfuse credentials from Langfuse Cloud or your self-hosted instance.

Parameter Description
baseUrl Langfuse API URL (e.g., https://cloud.langfuse.com)
publicKey Your Langfuse public key (pk-lf-...)
secretKey Your Langfuse secret key (sk-lf-...)

Custom Provider

Implement the ProviderInterface to add support for other LLM providers:

Full Example

See the example.php file for complete working examples.

API Reference

LangfuseLogger

setUserId($userId): self

Set the user ID for tracking. Returns self for method chaining.

setSessionId($sessionId): self

Set the session ID for grouping related traces. Returns self for method chaining.

log(ProviderInterface $provider, string $model, array $messages, array $response, array $metadata = []): bool

Log an LLM API call to Langfuse.

Parameter Type Description
$provider ProviderInterface Provider instance (e.g., new OpenAIProvider())
$model string Model name (e.g., gpt-4o, claude-3-5-sonnet)
$messages array The messages array sent to the API
$response array The decoded response from the API
$metadata array Optional additional metadata

Returns true on success, false on failure.

License

MIT License - see the LICENSE file for details.

Development

Contributing

Contributions are welcome! Please make sure tests pass before submitting a Pull Request.

Links


All versions of langfuse-logger with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package uodev/langfuse-logger contains the following files

Loading the files please wait ...