1. Go to this page and download the library: Download dayemsiddiqui/langfuse-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dayemsiddiqui / langfuse-sdk example snippets
use dayemsiddiqui\Langfuse\Langfuse;
$langfuse = new Langfuse();
// Get a raw prompt
echo $langfuse->getPrompt('welcome')->raw();
// Compile a prompt with variables
echo $langfuse->getPrompt('greeting')->compile(['name' => 'Alice']);
use dayemsiddiqui\Langfuse\Testing\LangfuseFake;
use dayemsiddiqui\Langfuse\Langfuse;
LangfuseFake::fake([
'greeting' => 'Hello {{name}}!',
'farewell' => 'Goodbye {{name}}!'
]);
$langfuse = app(Langfuse::class);
// This will use the fake prompt, no HTTP requests!
echo $langfuse->getPrompt('greeting')->compile(['name' => 'Test']); // "Hello Test!"