133 questions
0
votes
0
answers
40
views
Extending TextDescriptor for Symfony Console application
In an existing Symfony console app, I achieved a modified output I wanted to do (as a proof-of-concept exercise) by changing this class:
vendor/symfony/console/Helper/DescriptorHelper.php
I changed ...
1
vote
1
answer
137
views
extend a symfony bundle command
For a project, I am using the league/oauth2-server-bundle. This bundle has a command league:oauth:create-client that creates a client in the database.
In this project, I have a ClientConfiguration ...
-1
votes
1
answer
69
views
Symfony bin/console breaking with env arg
Using Symfony 6.2, running:
bin/console list
Works as expected - shows me a list of commands. However, running the same command using the prod env flag, gives me an error:
bin/console -e prod list
...
1
vote
1
answer
307
views
Symfony Console in a laminas app - how to get instance of console output in laminas factory
I have a laminas app that is using the symfony console as a cli. I have a complex service that sends information via events. I would like the output of the console to be a subscriber of the event, so ...
1
vote
1
answer
301
views
Unable to invoke symfony console command via "aws lambda invoke"
I'm trying to run symfony "bin/console" command like described in documentation.
Running command
aws lambda invoke \
--function-name PhpCliLambdaName \
--region us-east-1 \
--cli-...
1
vote
1
answer
735
views
Symfony 6.2 app not working as soon as a Command name is defined
docker-compose.yml
version: "3"
services:
nginx:
image: nginx:1.23.3
ports:
- "8084:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
php:
build: .
...
0
votes
1
answer
976
views
Symfony Console Commands v6 and Dompdf --- file_put_contents - Failed to open stream: Permission denied (windows)
I'm new to consoles stuff.
My goal is to create a platform independent command line (windows, mac, linux) to convert an hmtl file to a pdf.
I'm using to create the command Symfony Console Commands ...
1
vote
1
answer
4k
views
How to install a custom certificate in Symfony server?
With server:ca:install on the Symfony console an SSL certificate can be generated and installed.
Is it possible / How to install an existing one, created separately (instead of the auto-generated one)?...
2
votes
1
answer
894
views
How to properly calculate ETA in ProgressBar when (re)starting at a given position?
I'm using a ProgressBar for my console command, and allow the command to restart at some point in the middle of the processing:
$itemCount = 1_000_000;
$startItem = 150_000;
$progressBar = new ...
2
votes
1
answer
1k
views
Autocomplete doesn't work for a Symfony Console script
I have a Symfony Console app and I want to use it with autocomplete but autocoplite doesn't work. When I click tab nothing happens.
My app works successfully from the command line if I type like this:
...
1
vote
1
answer
636
views
How to get the description of a command without running it, using its name?
If I use a command like this one:
class ImportFilesCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setDescription('A text describing my ...
1
vote
1
answer
573
views
Calling command asks for interaction even if I have set it to false
Using Symfony 5.4, I have created a command to run several commands (just to refresh my app quickly), here is my code:
// @see https://symfony.com/doc/current/console/calling_commands.html
$...
1
vote
2
answers
2k
views
How to access the EntityManager in a Symfony Single Command Application?
I'm working on a Symfony Single Command Application. I'm using Doctrine to manage entities.
I created the entity configuration using the Symfony CLI and now I'm not sure how I can get access to the EM ...
0
votes
1
answer
395
views
Is it possible to achieve side-by-side table layout with Symfony Console?
┌──────── Summary: 1.1.5 update ─┬───────┐ ┌─────────────────────── Success ─┬─────────────────────┐
│ Success │ Failure │ In Progress │ Total │ │ Site │ End ...
6
votes
2
answers
3k
views
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
<?php
require_once __DIR__ . '/../vendor/autoload.php';
...
3
votes
1
answer
1k
views
Can't get service in command class. Symfony 3.4
I need to connect the services on the command line via autowire.
I use symfony 3.4 and I do not understand how to correctly register the settings for this. I have the following setting in app/config/...
2
votes
0
answers
475
views
Is there a way to override a Symfony container value with a Console argument?
tl;dr: I have a Symfony service configuration that binds a default string value to a named parameter, and I want to override it in a Console process with a command line option value.
I'm working on a ...
-1
votes
1
answer
610
views
I'm a window user and I am getting error during installation of laravel. I tried to re-install composer and install it again but nothing worked [duplicate]
Failed to extract symfony/console: (-1) "C:\Program Files\7-Zip\7z.EXE" x -bb0 -y "C:\Users\dhars\AppData\Roaming\Composer/vendor/composer/tmp-a9ced416c385f9f7faefbc038d77351a" -o&...
1
vote
1
answer
2k
views
Command "symfony console messenger:failed:show" not working
I am working the Symfony Fast Track Chapter 18.3
Configuring the Messenger Configuration (config/packages/messenger.yaml):
framework:
messenger:
# Uncomment this (and the failed transport ...
-1
votes
1
answer
364
views
How to fix "new property name: Aborted" error when make:entity command finishes?
I would like to make Doctrine entity via Symfony 4 console command
php bin/console make:entity article
The command creates the entity and repository file but it does not allow me to add fields to the ...
3
votes
0
answers
581
views
Testing Symfony custom maker (maker bundle)
I'm trying to make a custom maker with the Symfony make bundle.
The maker command looks like this:
<?php
namespace App\Maker;
use Doctrine\Common\Annotations\Annotation;
use Symfony\Bundle\...
1
vote
1
answer
540
views
Symfony Console Component - Error when output question and table
I'm writing a console app using Symfony Console Component. I'm trying to interact with questions and tables. I want to ask a question and then output a table and then ask another and output another ...
1
vote
1
answer
1k
views
Start Xdebug session for Symfony CLI commands
My dev setup includes PHP 8 and Xdebug 3 in a docker container for a Symfony project.
Currently I use xdebug.start_with_request=yes, but I don't like the performance impact that has.
How do I start an ...
1
vote
1
answer
1k
views
Symfony command php bin/console can't read Apache SetEnv?
With Symfony 5.2, when I execute this command
APP_ENV=prod php bin/console d:m:m
I have this message :
WARNING! You are about to execute a migration in database "db_name" that could ...
...
1
vote
3
answers
2k
views
Saving command logger output to log file and console
I wrote a very simple test command which has LoggerInterface injected in its constructor.
How am I suppose to change the monolog.yaml configuration to save this logger output to both log file and to ...
2
votes
1
answer
3k
views
How to run bin/console messenger:consume command out of Symfony project?
I use Messenger Component in a non-Symfony project and Doctrine as a DSN transport. Now I want to test my code and consume the messages on my local machine, but I don't know how to run the messenger ...
2
votes
1
answer
533
views
How to pass the output of command as the input of another?
I'm using a Symfony console application and trying to passed the output of phpstan as the input of my console command:
vendor/bin/phpstan analyse | bin/wte analyse
Currently the commands run as ...
1
vote
0
answers
822
views
Console cache: clear - Cannot declare a class already in use
I have a problem with symfony 5.1 and the cache:clear command line.
All of my work is working great on the browser. I've make some refactoring and move some pictures and I had a problem (it was due to ...
-2
votes
1
answer
687
views
I can't add option "-v" to console symfony [closed]
I want to add a command to my application console,
I can't add "-v" option to my code with ->addOption to run my command console on symfony.
When i run the command with bin/console app:...
1
vote
1
answer
856
views
Use of Extbase Repositories in Symfony Command
Im upgrading an extension to work with TYPO3 v10. Since command controllers can not be used anymore, im migrating them to symfony commands as pointed by the documentation. Everything works smooth as ...
-2
votes
1
answer
223
views
Is it possible to pass parameter as namespace in Symfony console?
I'd like to pass parameter to Symfony Console thus commandName:parameter1 parameter2. Is it possible and how I can do it?
2
votes
1
answer
3k
views
How to configure symfony check:requirements?
I am using Symfony for an application. This application needs particulars PHP extensions to work, such as PHP GD, which are not listed in the base Symfony requirements.
I would like to know if it's ...
2
votes
0
answers
346
views
Symfony Console Section Not Clearing All Lines
I'm trying to create a console table that refreshes itself every few seconds (this is to refresh stock data).
However I find that after a certain length, $section->clear() just doesn't clear all ...
1
vote
1
answer
404
views
How do I pass a wildcard GLOB to rsync wrapped by Symfony Console?
What I want to do
I want to move all XML files from /source/ to /target/
How I try to do it
rsync -avz --remove-source-files /source/*.xml /target/
I am using the Symfony Process / Console ...
1
vote
1
answer
3k
views
Get the whole console output from Symfony 5 OutputInterface
I've a Symfony 5 command like this:
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
....
...
0
votes
0
answers
232
views
mpdf fails to open image when run from console command
I'm using Symfony 4.3
I have an InvoiceService, which generates invoice into pdf file.
For html content I use \Twig\Environment::render() method. In the template I use twig asset() function for an ...
1
vote
0
answers
55
views
Update line text using Symfony Console (or PHP) [duplicate]
I want to make a console application that displays an user feedback for processes that runs for long time. Example:
Starting process
----------------
- Task 1 (5mb)
- Task 2 (7mb)
I want to update ...
2
votes
2
answers
2k
views
Psalm: Handle method that returns multiple types
EDIT This is a Psalm thing, not a PHP MD thing.
I am writing a Symfony console command. In its execute method I retrieve argument with the $input->getArgument('argument_name') method. And I pass ...
-2
votes
1
answer
653
views
Problem at start the server in the background with Symfony console
I update Symfony console to v4.12.0 . Now when I start the server in the background with Symfony console by symfony server:start -d this error display:
|ERROR| SERVER Impossible to go to the ...
0
votes
1
answer
992
views
Call to a member function addArguments() on null
I try to mock my laravel console command for PHPUnit testing. As constructor argument it requires an instance of the laravel config repository:
<?php
class AmazingCommandTest extends TestCase
{
...
0
votes
3
answers
1k
views
Localhost not working with fresh installation of Symfony
I know there is a thread on it ("Symfony fresh installation is not working on my localhost") but the solution didnt helped me.
I'm new to Symfony and I tried to create my first project. I installed a ...
0
votes
2
answers
4k
views
Early exit from Symfony Console execute()?
I'm using Sympfony Console as a standalone component.
Let's say I've got a Command defined as follows:
class Box extends Command
{
public function __construct() {
// removed for ...
3
votes
1
answer
2k
views
How to hide or delete the defaults available console commands?
I created a new Symfony 4 project via symfony new my_project_name.
Currently when I execute ./bin/console, the output shows
I will create some custom console commands and I want show only my custom ...
2
votes
1
answer
3k
views
How to display Command output in real time in Symfony 3.4 when calling from a Controller?
I have some commands in a Symfony 3.4 application that I call, from my controller: what I want to achieve is to get their output real-time and print it on the screen.
I tried almost everything about ...
1
vote
1
answer
1k
views
Enabling Sentry on Symfony console program without the whole symfony being installed
I have this plain console program:
namespace MyApp\Console;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
class MaConsole extends Command {
...
0
votes
1
answer
1k
views
How set console argument in symfony 3 console command testing
I am unable to set Argument while creating Unit test case in Symfony 3.4 console command application
My Console command
php bin\console identification-requests:process input.csv
My Console code
...
1
vote
1
answer
633
views
How to display console prompt for "choice()" in columns?
In a Laravel command, I am looking for a way to display the 52 options in multiple columns rather than one long list that requires scrolling.
Is this possible?
This is the code I have so far:
do {
...
4
votes
3
answers
6k
views
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 ...
0
votes
1
answer
107
views
Symfony command question input doesn't finishes
I'm trying to create a symfony console command. I'm using symfony Question to ask for input. But in console input doesn't finishes by "enter" press
That's code I have in my command execute method:
$...
0
votes
1
answer
213
views
What is Container for zend-expressive symfony console command
I'm currently trying to integrate this library
https://www.xtreamwayz.com/blog/2016-02-07-zend-expressive-console-cli-commands
It seems it requires
$container = require __DIR__ . '/config/...