PHP code example of asterixcapri / neuron-tui

1. Go to this page and download the library: Download asterixcapri/neuron-tui 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/ */

    

asterixcapri / neuron-tui example snippets




use NeuronAI\Agent\Agent;
use NeuronAI\Chat\History\InMemoryMessageStore;
use NeuronAI\Providers\OpenAI\Responses\OpenAIResponses;
use NeuronAI\Tools\Toolkits\FileSystem\FileSystemToolkit;
use NeuronInteraction\Conversation;
use NeuronInteraction\Session\SessionStore;
use NeuronInteraction\Storage\InMemoryStorage;
use NeuronTui\Tui;

$agent = Agent::make()
    ->setAiProvider(new OpenAIResponses(
        key: 'your-openai-api-key',
        model: 'gpt-5.4-nano',
    ))
    ->addTool(FileSystemToolkit::make(__DIR__));

$session = (new SessionStore(new InMemoryStorage(), new InMemoryMessageStore(), 'local'))->create();
$conversation = new Conversation($agent, $session);

(new Tui($conversation))->run();

(new Tui($conversation))
    ->setTitle('Filesystem Agent')
    ->setDescription('Explore, read and edit files with Neuron AI')
    ->run();

(new Tui($conversation))
    ->setFiglet('Neuron', 'small')
    ->setTitle('Filesystem Agent')
    ->setDescription('Explore, read and edit files with Neuron AI')
    ->run();

use NeuronInteraction\Command\Commands;
use NeuronInteraction\Command\ExitCommand;
use NeuronInteraction\Command\HelpCommand;

$conversation->setCommands(new Commands(new HelpCommand(), new ExitCommand()));
(new Tui($conversation))->run();

use NeuronInteraction\InputHistory\InputHistory;

$conversation->setInputHistory(new InputHistory($storage, 'local'));
bash
php examples/basic.php
bash
php examples/commands.php
bash
php examples/advanced.php