Search by

kjgcoop / trilium-notes-api

kjgcoop

A package to make changes to a Trilium Notes instance

Package info

github.com/kjgcoop/trilium-notes-api

pkg:composer/kjgcoop/trilium-notes-api

Statistics

Installs: 26

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.3.0 2026-09-15 08:06 UTC

This package is auto-updated.

Last update: 2026-09-16 04:58:22 UTC


README

Simple API to talk to a Trilium Notes instance. This is php-trilium-next-api with a facelift.

Usage

No config file needed - construct the client directly with your endpoint and API key:

use Kjgcoop\TriliumNotesApi\TriliumNotesApi;

$api = new TriliumNotesApi(
    'https://your-trilium-domain/etapi/',
    'your-etapi-key'
);

The endpoint must use https:// - the API key is sent as a plain Authorization header, so the constructor rejects an http:// endpoint.

Logging

Pass a PSR-3 LoggerInterface as the third constructor argument to capture request failures. Without one, failures are only raised as exceptions.

$api = new TriliumNotesApi($endpoint, $apiKey, $logger);

Custom HTTP client

A fourth, optional argument accepts a Guzzle ClientInterface, useful for tests or custom HTTP configuration (proxies, custom timeouts, etc.). If omitted, a default client with a 10-second timeout is used.

$api = new TriliumNotesApi($endpoint, $apiKey, $logger, $httpClient);