1. Go to this page and download the library: Download skald/skald-php 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/ */
skald / skald-php example snippets
kald\Skald;
use Skald\Types\MemoData;
use Skald\Types\SearchRequest;
use Skald\Types\SearchMethod;
use Skald\Types\ChatRequest;
// Initialize the client
$skald = new Skald('sk_proj_your_api_key');
// Create a memo
$result = $skald->createMemo(new MemoData(
title: 'Meeting Notes - Q1 Planning',
content: 'Discussed quarterly goals, hiring plans, and budget allocation...',
tags: ['meeting', 'planning', 'q1'],
source: 'notion'
));
// Search for memos
$results = $skald->search(new SearchRequest(
query: 'quarterly goals',
searchMethod: SearchMethod::CHUNK_VECTOR_SEARCH,
limit: 10
));
foreach ($results->results as $result) {
echo "Title: {$result->title}\n";
echo "Summary: {$result->summary}\n";
echo "Relevance: {$result->distance}\n\n";
}
// Ask questions about your knowledge base
$response = $skald->chat(new ChatRequest(
query: 'What are our main goals for Q1?'
));
echo $response->response; // "The main Q1 goals are... [[1]]"
$skald = new Skald(string $apiKey, ?string $baseUrl = null);
// Delete by memo UUID (default)
$skald->deleteMemo('memo-uuid-here');
// Delete by client reference ID
$skald->deleteMemo('external-id-123', 'reference_id');
// Delete with project ID (for Token Authentication)
$skald->deleteMemo('memo-uuid-here', 'memo_uuid', 'project-uuid-123');
// Delete by reference ID with project ID
$skald->deleteMemo('external-id-456', 'reference_id', 'project-uuid-789');
new ChatRequest(
query: string, // Required - question to ask
);
$response = $skald->chat(new ChatRequest(
query: 'What are the key features of our mobile app?'
));
echo $response->response;
// Output: "The mobile app has several key features: 1. Offline mode [[1]]
// 2. Push notifications [[2]] 3. Biometric authentication [[1]]"
// Citations [[1]], [[2]], etc. reference source memos
$response = $skald->generateDoc(new GenerateDocRequest(
prompt: 'Create a product imeline'
));
echo $response->response;
// Outputs a full document with inline citations