Download the PHP package skald/skald-php without Composer
On this page you can find all versions of the php package skald/skald-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download skald/skald-php
More information about skald/skald-php
Files in skald/skald-php
Package skald-php
Short Description Official PHP SDK for Skald API - Knowledge base management with semantic search, AI chat, and document generation
License MIT
Informations about the package skald-php
Skald PHP SDK
Official PHP SDK for Skald API - A knowledge base management system that automatically processes memos (summarizes, chunks, and indexes them) and provides semantic search, AI chat, and document generation capabilities.
Features
- Memo Management: Create and store memos with automatic processing (summarization, chunking, indexing)
- Semantic Search: Search through your knowledge base using vector search or title matching
- AI Chat: Ask questions about your knowledge base with AI-powered responses and inline citations
- Document Generation: Generate documents based on prompts with context from your knowledge base
- Streaming Support: Real-time streaming for chat and document generation operations
- Type-Safe: Fully typed with PHP 8.1+ features including enums and readonly properties
Requirements
- PHP 8.1 or higher
- cURL extension
- JSON extension
Installation
Install via Composer:
Quick Start
API Reference
Client Initialization
$apiKey: Your Skald API key (required)$baseUrl: Optional custom API base URL (defaults tohttps://api.useskald.com)
Creating Memos
Parameters:
Example:
Updating Memos
Update an existing memo with partial or complete changes. All fields are optional - only include the fields you want to update.
Important: When content is updated, the memo is automatically reprocessed by the API (summary, tags, and chunks are regenerated). Other field updates preserve existing processing results.
Parameters:
$memoId(string): The memo UUID or client reference ID$updateData(UpdateMemoData): The fields to update$idType(string, optional): Type of identifier -'memo_uuid'(default) or'reference_id'$projectId(string|null, optional): Project UUID (required when using Token Authentication)
Examples:
Deleting Memos
Delete a memo and all its associated data (content, summary, tags, chunks).
Parameters:
$memoId(string): The memo UUID or client reference ID$idType(string, optional): Type of identifier -'memo_uuid'(default) or'reference_id'$projectId(string|null, optional): Project UUID (required when using Token Authentication)
Examples:
Searching Memos
Search Methods:
SearchMethod::CHUNK_VECTOR_SEARCH- Semantic search on memo chunks (returns distance scores 0-2)SearchMethod::TITLE_CONTAINS- Case-insensitive substring match on titlesSearchMethod::TITLE_STARTSWITH- Case-insensitive prefix match on titles
Parameters:
Example:
AI Chat (Non-Streaming)
Parameters:
Example:
AI Chat (Streaming)
Example:
Document Generation (Non-Streaming)
Parameters:
Example:
Document Generation (Streaming)
Example:
Error Handling
All API errors throw Skald\Exceptions\SkaldException:
Type Reference
Enums
SearchMethod
Request Types
MemoData
title: string- Memo title (max 255 characters)content: string- Memo contentmetadata: ?array- Custom metadatareference_id: ?string- External reference IDtags: ?array- Array of tag stringssource: ?string- Source system identifier
UpdateMemoData
title: ?string- Memo title (max 255 characters)content: ?string- Memo content (triggers reprocessing when updated)metadata: ?array- Custom metadataclient_reference_id: ?string- External reference ID (max 255 characters)source: ?string- Source system identifier (max 255 characters)expiration_date: ?string- Expiration date in ISO 8601 format
SearchRequest
query: string- Search querysearchMethod: SearchMethod- Search method to uselimit: ?int- Results limit (1-50, default 10)filters: ?array- Array of Filter objects to narrow results
ChatRequest
query: string- Question to ask
GenerateDocRequest
prompt: string- Document generation promptrules: ?string- Style/format guidelines
Response Types
CreateMemoResponse
ok: bool- Success status
SearchResponse
results: SearchResult[]- Array of search results
SearchResult
uuid: string- Memo unique identifiertitle: string- Memo titlesummary: string- Auto-generated summarycontent_snippet: string- Content snippetdistance: ?float- Relevance score (0-2 for vector search, null for title searches)
ChatResponse
ok: bool- Success statusresponse: string- AI response with inline citationsintermediate_steps: array- Debug information
GenerateDocResponse
ok: bool- Success statusresponse: string- Generated document with citationsintermediate_steps: array- Debug information
Stream Event Types
ChatStreamEvent & GenerateDocStreamEvent
type: string- Event type ('token' or 'done')content: ?string- Token content (only for 'token' events)isToken(): bool- Check if event is a tokenisDone(): bool- Check if event signals completion
Examples
See the examples/ directory for complete working examples:
create_memo.php- Creating memos with various optionsupdate_memo.php- Updating existing memos (including by reference ID)delete_memo.php- Deleting memos (by UUID or reference ID)search.php- All search methods with exampleschat.php- Non-streaming chatchat_streaming.php- Streaming chat with real-time outputgenerate_doc.php- Document generationgenerate_doc_streaming.php- Streaming document generation
Testing
Run the test suite:
Integration Tests
Integration tests require a valid Skald API key:
Development
Code Quality Tools
This library uses:
- PHPUnit for testing
- PHPStan (level 8) for static analysis
- PHP_CodeSniffer for PSR-12 compliance
Run all checks:
License
MIT License - Copyright (c) 2025 Skald Labs, Inc.
See LICENSE file for details.
Contributing
If you've spotted a bug or want a new feature, feel free to submit a PR.
All versions of skald-php with dependencies
ext-curl Version *
ext-json Version *