Repository navigation
Upgrade Guide 0.1.4 to 0.2.0
Tycho Engberink edited this page Feb 19, 2026
·
2 revisions
Environment and label are now set at construction time instead of per-call.
// Before
$langfuse = new Langfuse($transporter);
$langfuse->ingestion('production');
// After
$langfuse = new Langfuse($transporter, environment: 'production', label: 'latest');
$langfuse->ingestion();$name is the first required parameter. $traceId is optional (auto-generated). Returns a Trace object.
// Before
$langfuse->ingestion()->trace(
input: $input,
output: $output,
traceId: 'my-trace-id',
name: 'my-trace',
sessionId: 'session-1',
metadata: ['key' => 'value'],
);
// After
$trace = $langfuse->ingestion()->trace(
name: 'my-trace',
traceId: 'my-trace-id', // optional, auto-generated if omitted
sessionId: 'session-1',
input: $input,
output: $output,
metadata: ['key' => 'value'],
);Returns a Generation object. $sessionId has been removed (belongs on the trace).
// Before
$langfuse->ingestion()->generation(
input: $input,
output: $output,
traceId: 'my-trace-id',
name: 'my-generation',
sessionId: 'session-1',
model: 'gpt-4',
);
// After
$generation = $langfuse->ingestion()->generation(
traceId: 'my-trace-id',
name: 'my-generation',
input: $input,
output: $output,
model: 'gpt-4',
);
// Or use the fluent API
$trace = $langfuse->ingestion()->trace(name: 'my-trace');
$generation = $trace->generation(
name: 'my-generation',
input: $input,
output: $output,
model: 'gpt-4',
);Returns a Generator with automatic pagination. The $page parameter is removed.
// Before
$response = $langfuse->prompt()->list(name: 'my-prompt', page: 1);
foreach ($response->data as $item) {
// ...
}
// After
foreach ($langfuse->prompt()->list(name: 'my-prompt') as $item) {
// $item is a PromptListItem
}$version changed from ?string to ?int.
// Before
$langfuse->prompt()->text('my-prompt', version: '1');
// After
$langfuse->prompt()->text('my-prompt', version: 1);If you have a custom TransporterInterface implementation, add these two methods:
public function delete(string $uri, array $options = []): ResponseInterface;
public function patchJson(string $uri, array $data = [], array $options = []): ResponseInterface;No changes needed if you use the built-in HttpTransporter.