Download the PHP package elephpantmemory/memory without Composer

On this page you can find all versions of the php package elephpantmemory/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 memory

ElePHPantMemory 🐘💬

PHP Version

An ultra-lightweight, zero-dependency local memory and context manager for AI chatbots. Written in pure, modern PHP 8.4+ using property hooks and asymmetric visibility.

Gestor de memória e contexto local para chatbots de IA. Ultra leve, rápido e sem dependências externas. Escrito em PHP 8.4+ puro e moderno.


🧐 "Does anyone actually use this, or is it completely useless?" / "Quem é que usa esta merda?"

English

If you are building an AI chatbot using standard APIs (like OpenAI, Claude, or Gemini) and think "I'll just pass the entire chat history in every request," you will quickly realize:

  1. Your API bill explodes as the conversation grows.
  2. The chatbot loses its mind when the conversation exceeds token limits.
  3. Setting up a Vector Database (Pinecone, pgvector) just to store simple facts (like the user's name, city, or order preferences) is massive overkill.

ElePHPantMemory solves this inside your existing database (SQLite, MySQL, Postgres, SQL Server) without any extra services:


Português (Portugal)

Se estás a desenvolver um chatbot de IA com APIs (OpenAI, Claude, Gemini) e pensas "basta-me mandar o histórico todo em cada pedido", vais perceber muito rápido que:

  1. A tua fatura da API explode à medida que a conversa avança.
  2. O chatbot perde o fio à meada quando as mensagens excedem o limite de tokens.
  3. Instalar uma base de dados vetorial (Pinecone, pgvector) só para guardar factos básicos (como o nome do utilizador, a cidade ou o ID da encomenda) é complicar o que devia ser simples.

O ElePHPantMemory resolve isto diretamente na tua base de dados atual (SQLite, MySQL, Postgres, SQL Server):


🗺️ How it Works / Como Funciona


📊 Features & Comparison / Caraterísticas e Comparação

Feature / Funcionalidade Standard AI Chat Flow With ElePHPantMemory 🐘
API Token Costs / Custos de Tokens 📈 Increases exponentially 📉 Flat and optimized
Memory Retention / Retenção de Memória ❌ Forgets when context limits hit 🧠 Never forgets core facts
Dependencies / Dependências 📦 Heavy framework overhead ❌ Zero (Vanilla PHP 8.4+)
Database Setup / Configuração de BD ⚙️ Requires external Vector DB Reuses your active connection
GDPR Compliance / Pronto para RGPD 🛠️ Manual code required ⚡ Automated local TTL purging

🛠️ Quick Start / Guia Rápido

Installation / Instalação

Option A: Composer (Recommended / Recomendado)

Option B: Manual Include / Importação Manual

Download the package files and include the main manager file: Descarrega os ficheiros do pacote e importa o ficheiro do gestor principal:


🚀 Usage Examples / Exemplos de Uso

1. Basic Local Storage (Manual Facts) / Armazenamento Local Simples (Factos Manuais)

Manually save messages and facts (useful if you handle the AI calls manually for fact extraction). Regista mensagens e factos manualmente (útil se já tratas da chamada de IA de outra forma).

2. Intelligent Auto-Memory (Zero-Dependency AI Integration)

Let ElePHPantMemory automatically extract facts from chats and summarize old conversations using OpenAI or Gemini natively (via cURL). Deixa o ElePHPantMemory extrair factos e sumarizar conversas antigas automaticamente usando OpenAI ou Gemini nativo (via cURL).

3. Custom Providers / Integração de Provedores Customizados

If you use a framework wrapper (like Laravel's LLM clients, or a custom wrapper), you can bind it directly using CustomProvider. Se usas outro wrapper de IA (ex: pacotes do Laravel ou SDKs oficiais), podes integrá-lo usando o CustomProvider.

4. Memory Lifecycle Operations / Gestão do Ciclo de Vida da Memória

5. Custom Table Prefixes / Prefixo de Tabelas Customizado

If you want to prevent database table name conflicts with your existing tables, you can configure a custom prefix (default is em_) in the constructor. Se quiseres evitar conflitos de nomes de tabelas na tua base de dados, podes definir um prefixo personalizado (o padrão é em_) no construtor.

6. Temporary Facts (TTL Expiration) / Factos Temporários (Expiração por TTL)

You can set an optional TTL in seconds for specific facts. The library automatically cleans up expired facts during runtime context generation. Podes definir um tempo de vida útil (TTL) em segundos para factos específicos. A biblioteca limpa automaticamente os factos expirados em tempo de execução.

7. Custom Extraction Guidelines / Diretrizes de Extração Personalizadas

Guide the AI on what details to extract (or ignore) during automatic fact extraction. Orienta a IA sobre que detalhes extrair (ou ignorar) durante a extração automática de factos.

8. Custom Context Formatters / Formatador de Contexto Customizado

Customize how facts and summaries are formatted in the system prompt injected into your AI calls. Personaliza a forma como os factos e o sumário são formatados no prompt do sistema injetado nas chamadas de IA.


🏗️ Requirements & DB Schemas / Requisitos e Esquemas de BD

The library automatically checks and initializes these two tables:

  1. em_history: Stores message history.
  2. em_facts: Stores extracted facts and conversation summaries.

🛡️ Error Handling / Tratamento de Erros

ElePHPantMemory throws custom exceptions under the ElePHPantMemory namespace, all extending ElePHPantException:


🧪 Testing / Testes

You can run the built-in, zero-dependency test suite using the following command: Podes correr a suite de testes integrada e sem dependências usando o seguinte comando:


🤝 Contributing / Contribuir

Contributions are welcome! Please check CONTRIBUTING.md for architecture guidelines. Keep it dependency-free, and ensure PHP code files remain ASCII-clean (no special accents in class/method names or comments).

Contribuições são bem-vindas! Verifica o ficheiro CONTRIBUTING.md para diretrizes de arquitetura. Mantém o código PHP livre de dependências externas e sem caracteres especiais ou acentos no código fonte.


⚖️ License / Licença

This project is licensed under the GNU General Public License v3.0 (GPL-3.0) - see the LICENSE file for details.

Este projeto está licenciado sob a GNU General Public License v3.0 (GPL-3.0) - consulta o ficheiro LICENSE para mais detalhes.


All versions of memory with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
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 elephpantmemory/memory contains the following files

Loading the files please wait ...