PHP code example of memcode / neuron-ai

1. Go to this page and download the library: Download memcode/neuron-ai library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

memcode / neuron-ai example snippets




declare(strict_types=1);

namespace App\Neuron;

use Memcode\NeuronAI\MemcodeMemoryToolkit;
use NeuronAI\Agent;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Anthropic\Anthropic;

final class PersonalAssistant extends Agent
{
    protected function provider(): AIProviderInterface
    {
        return new Anthropic(
            key: getenv('ANTHROPIC_API_KEY'),
            model: 'claude-sonnet-4-6',
        );
    }

    protected function tools(): array
    {
        return [
            MemcodeMemoryToolkit::make(
                token: getenv('MEMCODE_API_KEY'),
            ),
        ];
    }
}

use Memcode\NeuronAI\MemcodeMemoryToolkit;
use Memcode\NeuronAI\Tools\ListMemoriesTool;

$memory = MemcodeMemoryToolkit::make(getenv('MEMCODE_API_KEY'))
    ->exclude([ListMemoriesTool::class]);

$memory = MemcodeMemoryToolkit::make(
    token: getenv('MEMCODE_API_KEY'),
    baseUri: 'https://memory.example.com',
);