Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

symfony/console v7.0.6

Eases the creation of beautiful and testable command line interfaces
Package summary
Share
0
issues
0
licenses
Package created
16 Oct 2011
Version published
1 Apr 2024
Maintainers
1
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does symfony/console do?

Symfony/Console is a PHP component that simplifies the development of command-line interfaces (CLI). This powerful tool enhances code readability, testability, and overall development productivity, making it easier to create user-friendly and robust console commands. It is a long-established and reputable part of the Symfony ecosystem and is backed by the cooperative Les-Tilleuls.coop.

How do you use symfony/console?

Using Symfony/Console involves installing it and creating a console command. Installation is straightforward and completed with Composer, a commonly used dependency manager in PHP. Below is an example of how to require it in your project:

composer require symfony/console

To create a new console command using the Symfony/Console, you will need to create a new PHP class for your command and define its functionality. An example of how to formulate a simple console command is shown below:

namespace App\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class GreetingCommand extends Command
{
    protected static $defaultName = 'app:greet';

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->writeln('Hello from Symfony/Console!');

        return Command::SUCCESS;
    }
}

Make sure to add your command to your Symfony console application:

use App\Command\GreetingCommand;
use Symfony\Component\Console\Application;

$application = new Application();
$application->add(new GreetingCommand());
$application->run();

Where are the symfony/console docs?

The complete Symfony/Console documentation can be found on the official Symfony website at the following address: https://symfony.com/doc/current/components/console.html. The documentation provides a comprehensive guide and best practices for using the component, contributing to its development, and reporting issues or sending pull requests via the main Symfony repository on GitHub.