
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node-symfony-console
Advanced tools
This is a straight port of Symfony's Console Component v5.1. Augmented with the spinner functionality largely inspired by alecrabbit/php-console-spinner
Although fully functional, this is very much WIP.
Eventually we will write ported documentation. For now follow Console Component v5.1 documentation and translate the examples to JS.
// Most used classes are accessible as direct imports
const {
Terminal,
Application,
SingleCommandApplication,
Command,
Question,
ConfirmationQuestion,
ChoiceQuestion,
ProgressBar,
ProgressIndicator,
Table,
TableStyle,
Output,
Input,
InputArgument,
InputOption,
Spinner,
SpinnerFrames} = require('node-symfony-console');
// All of the underlying classes can be accessed throught the console export. Follow the
// original PhP namespace class paths.
const { console } = require('node-symfony-console');
// PHP Class \Symfony\Component\Console\Helper\HelperSet
const HelperSet = console.helper.HelperSet;
// PHP Class \Symfony\Component\Console\Tester\CommandTester
const CommmandTester = console.tester.CommandTester;
Create a command
const { Command, InputArgument, ConfirmationQuestion } = require('node-symfony-console');
class GreetCommand extends Command {
static get defaultName() {
return 'foo:helloworld';
}
configure() {
this
// the short description shown while running "node bin/console list"
.setDescription(`Print hello world`)
// the full command description shown when running the command with
// the "--help" option
.setHelp('Print hello world, pass argument')
.addArgument('name', InputArgument.REQUIRED, 'Who do you want to greet?')
.addArgument('last_name', InputArgument.OPTIONAL, 'Your last name?');
}
async execute(input, output) {
// Do something asynchronous like an API call or
// asking a question
const q = new ConfirmationQuestion('<info>Are you leaving</info> (y/n): ');
const leaving = await this.getHelper('question').ask( input, output, q);
let greet = `${leaving?'Good Bye':'Hi'} ${input.getArgument('name')}`;
const lastName = input.getArgument('last_name');
if (lastName) {
greet = `${greet} ${lastName}`;
}
output.writeln(`${greet}!`);
return 1;
}
}
module.exports = GreetCommand;
Create a application and include the command. This can be any file IE: bin/console.js
const {Application} = require('node-symfony-console');
const GreetCommand = require('./GreetCommand');
const application = new Application();
application.add(new GreetCommand());
application.run();
Run the command:
$ node bin/console.js
Console Tool
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
list Lists commands
foo
foo:helloworld Print hello world
$ node bin/console.js foo:helloworld Jeroen
Are you leaving (y/n): n
Hi jeroen!
$ node bin/console.js foo:helloworld Jeroen "de Lau"
Are you leaving (y/n): y
Good Bye Jeroen de Lau!
Porting changes:
const {Output} = require('node-symfony-console')Omissions: Following have not (yet) been ported
Contributions are welcome! Most of the tests have been written in JS.
This library is converted from Symfony's Console Component: Find sources and license at https://github.com/symfony/component
This library uses code from the spinner library Find sources and license at https://github.com/alecrabbit/php-console-spinner
FAQs
Symfony Console Component ported to Node
We found that node-symfony-console demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.