adachsoft / symfony-console-tool
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/adachsoft/symfony-console-tool
Requires
- adachsoft/ai-tool-call: 2.0.1
- adachsoft/command-executor-lib: 2.0.0
- adachsoft/normalized-safe-path: ^0.1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.89
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.4
- rector/rector: ^2.3
- symfony/console: ^8.0
This package is not auto-updated.
Last update: 2026-02-02 18:59:31 UTC
README
Library providing an AI SPI tool for running Symfony Console commands (run) and listing available commands (list) in external Symfony projects.
Installation
composer require adachsoft/symfony-console-tool
Usage with adachsoft/ai-tool-call (SPI)
Register SymfonyConsoleToolFactory in the AiToolCallFacadeBuilder and configure the tool using ConfigMap:
use AdachSoft\AiToolCall\PublicApi\Builder\AiToolCallFacadeBuilder;
use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;
use AdachSoft\SymfonyConsoleTool\Tool\SymfonyConsoleToolFactory;
$builder = AiToolCallFacadeBuilder::new()
->withSpiFactories([
new SymfonyConsoleToolFactory(),
])
->withToolConfigs([
'symfony_console' => new ConfigMap([
'base_path' => '/path/to/your/symfony/project',
'console_path' => 'bin/console',
'php_binary' => 'php',
'timeout' => 30.0,
]),
]);
$facade = $builder->build();
Then you can call the symfony_console tool via the public API:
use AdachSoft\AiToolCall\PublicApi\Dto\ToolCallRequestDto;
// List commands
$listResult = $facade->callTool(new ToolCallRequestDto(
toolName: 'symfony_console',
parameters: [
'action' => 'list',
],
));
// Run a specific command
$runResult = $facade->callTool(new ToolCallRequestDto(
toolName: 'symfony_console',
parameters: [
'action' => 'run',
'command' => 'cache:clear --env=prod',
],
));
The result payload is an array with the following keys:
exit_code(int) command exit codeoutput(string) STDOUT contentserror_output(string) STDERR contents
Security
console_path is resolved relative to base_path using adachsoft/normalized-safe-path. Any attempt to escape base_path (path traversal) will result in an error and the tool call will fail.