Download the PHP package tivins/llm-memory without Composer

On this page you can find all versions of the php package tivins/llm-memory. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package llm-memory

tivins/llm-memory

Semantic memory store for LLM applications — embed, store, and recall text fragments via pgvector.

Overview

A PHP library that provides a RAG-style retrieval pipeline:

  1. Store text fragments in PostgreSQL + pgvector with automatic embedding.
  2. Recall relevant fragments using a two-stage pipeline: vector ANN search → cross-encoder reranking.
  3. Deduplicate entries via SHA-256 content hashing per collection.

Requirements

Installation

Quick start

Agent integration

Wire memory tools into an llm-lib agent:

Collections are typically namespaced (user:{id}, {app}:{scope}). See examples/agent.php for a full runnable demo.

API

Method Description
ensureCollection(id, model, dim) Create a collection if it doesn't exist
remember(collection, content, kind?, metadata?) Store a text fragment (embeds automatically, deduplicates)
rememberMany(collection, items) Batch store — one embedding call for N fragments
recall(collection, query, topN?, annTopK?, minRerankScore?) Retrieve relevant entries (ANN + optional rerank)
recallAnnOnly(collection, query, topN?) ANN search only — skips rerank even when a reranker is configured
listEntries(collection, limit?, offset?, idFrom?, idTo?) List entries (latest N or ID range)
getById(id) Fetch a single entry by ID
forget(id) Soft-delete a single entry (any collection)
forgetInCollection(collection, id) Soft-delete within a collection; returns false if not found
forgetCollection(id) Soft-delete all entries in a collection
count(collection) Count active entries in a collection
migrate() Run SQL migrations

Testing

Integration tests require PostgreSQL with pgvector (see install.md). Unit tests for DTOs run without a database. Embedding/rerank calls use StubLLM from llm-lib — no llama.cpp server needed.

Dependencies

Package Role
tivins/llm-lib Embedding & rerank HTTP clients
tivins/pdow PDO database wrapper

License

MIT.


All versions of llm-memory with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
tivins/pdow Version ^0.1
tivins/llm-lib Version ^0.5
ext-pdo Version *
ext-pgsql Version *
tivins/php-core Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tivins/llm-memory contains the following files

Loading the files please wait ...