Questions tagged [symfony-console]

The Console component allows developers to create command-line commands. Console commands can be used for any recurring task, such as cron-jobs, imports, or other batch jobs.

The Console component allows developers to create command-line commands. Console commands can be used for any recurring task, such as cron-jobs, imports, or other batch jobs.

130 questions
18
votes
7 answers

How to check the environment using the Symfony console tool?

I use the Symfony CLI tool and I'm looking for a way to check the environment. I could not find anything like $ php bin/console get environment Is there another way for that? Is it possible / How to find out, which environment is currently…
automatix
  • 14,018
  • 26
  • 105
  • 230
17
votes
12 answers

Symfony: command not found

I am trying working with symfony since past couple of months. Last night I did an auto remove to purge not needed repositories. After that I have not been able to create a new symfony project using the symfony command. When I run Symfony new…
utkarsh2k2
  • 1,046
  • 3
  • 19
  • 42
15
votes
4 answers

How to identify if an option was supplied without a value with Symfony Console?

With the Symfony3 Console, how can I tell when a user supplied an option, but supplied it without a value? As opposed to not supplying the option at all? As an example, take the following console configuration.
Courtney Miles
  • 3,756
  • 3
  • 29
  • 47
11
votes
3 answers

how do I use Symfony console with dependency injection, without the Symfony framework bundle?

I have a command-line application, which so far uses the Symfony dependency injection component. I now find that I want to add command-line options and improve the formatting of the output, and the Symfony console component seems like a good choice…
joachim
  • 28,554
  • 13
  • 41
  • 44
10
votes
2 answers

Symfony console - displaying help for command with no arguments

I'm developing a pretty simple Symfony console application. It has just one command with one argument, and a few options. I followed this guide to create an extension of the Application class. This is the normal usage for the app, and it works…
gazareth
  • 1,135
  • 10
  • 26
7
votes
2 answers

Catching terminal terminations/exits with Symfony Console (CTRL+C)

I have built a command which triggers file downloads from over the internet, however since these files need to be processed by another component, we need to make sure that every file that has been downloaded and has not been modified in the last 10…
GiamPy
  • 3,543
  • 3
  • 30
  • 51
7
votes
4 answers

Symfony/Console: How to use multiple progress bars?

I have a command for Symfony/Console which downloads several files at once using Guzzle Pool. I already have Guzzle reporting the download progress for each file, that works fine. Now I'd like to improve it using the ProgressBar helper from…
enumag
  • 830
  • 11
  • 21
6
votes
0 answers

symfony/console input length

I am writing a symfony/console application (using v4 components) and I am running into an issue with input lengths on questions. When asking for user input it appears I can only input upto 1023 characters? Is there a way to increase this - or is it…
OnIIcE
  • 811
  • 9
  • 27
5
votes
1 answer

How to use DependencyInjection from symfony in stand alone application with commands?

I have been using symfony/console for making commands and registering them like that, everything works fine: bin/console: #!/usr/bin/env php
5
votes
4 answers

Symfony 4 - 3rd-party bundle commands are no longer automatically discovered

According to the documentation, a command class must extend Command or ContainerAwareCommand to be automatically discovered and registered (provided its bundle is registered in the Kernel, of course). Since Symfony 4+, this discovery doesn't work as…
Ben
  • 845
  • 1
  • 8
  • 18
5
votes
1 answer

Symfony 4, a way for generate Entities from an Existing Database?

With Symfony 3 and its console, we can generate entities from an already existing database via the command "php bin/console doctrine:mapping:import" (very usefull !). From symfony 4, the command "./bin/console doctrine:mapping:import" needs a bundle…
spacecodeur
  • 2,206
  • 7
  • 35
  • 71
5
votes
1 answer

Symfony Console - Overwrite default options

I'm building a CLI application for my app using Symfony Console. The application is required to do some simple package management operations to manage plugins. Therefore, I need a command option named --version with shortcut -v, which does not seem…
Moritz Friedrich
  • 1,371
  • 20
  • 38
5
votes
2 answers

Run multiple Symfony console commands, from within a command

I have two commands defined in a Symfony console application, clean-redis-keys and clean-temp-files. I want to define a command clean that executes these two commands. How should I do this?
user2064000
4
votes
3 answers

Symfony - Best practice to reset the database

I'm working on a Symfony 4.2 project and I'm looking for the best practice to achieve a reset of the database when the admin needs to do it via a button in backoffice. Explanation : The project is a temporary event website. This means that, people…
Alexis
  • 347
  • 5
  • 16
4
votes
0 answers

Symfony required arguments in console comand not working

I am using Symfony's console component, in a command with 1 required option and 1 required argument. However, upon execution the option and argument are NOT required. Am I missing something? Relevant code below. protected function configure() { …
Stephane Gosselin
  • 9,030
  • 5
  • 42
  • 65
1
2 3
8 9