gridwb/laravel-mem0

Mem0 API for Laravel

Installs: 19

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/gridwb/laravel-mem0

1.0.6 2025-09-05 15:09 UTC

This package is auto-updated.

Last update: 2025-10-07 13:53:12 UTC


README

Laravel Mem0 is a convenient wrapper for interacting with the Mem0 API in Laravel applications.

Installation

  1. Install the package

    composer require gridwb/laravel-mem0
  2. Publish the configuration file

    php artisan vendor:publish --tag="mem0-config"
  3. Add environment variables

    MEM0_API_URL=https://api.mem0.ai
    MEM0_API_KEY=your-api-key-here

Usage

use Gridwb\LaravelMem0\Facades\Mem0;

$data = [
    'user_id'  => 'alex',
    'messages' => [
        [
            'role'    => 'user',
            'content' => '<user-message>'
        ],
        [
            'role'    => 'assistant',
            'content' => '<assistant-message>'
        ]
    ]
];

$result = Mem0::memories()->addAsync($data);
$result = Mem0::memories()->addSync($data);

$result = Mem0::memories()->search([
    'query'   => 'What do you know about me?',
    'filters' => [
        'OR' => [
            [
                'user_id' => 'alex',
            ],
            [
                'agent_id' => [
                    'in' => [
                        'travel-assistant',
                        'customer-support'
                    ]
                ]
            ]
        ]
    ]
]);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.