Reputation: 10725
There are console programs, like an editor (say: nano
for example) or like a system monitor (say: htop
) where you can "navigate" with arrows and freely interact with the content.
In this example, for example I have executed htop
and while it's running I've pressed arrow-down multiple times until the PID 14 has been selected:
In Symfony I can easily print and also format with colors with the OutputInterface
that is injected into the commands.
But... can this "interactivity" be achieved easily with PHP and symfony console commands?
For the sake of the example: Could I code a simple "snake" game in PHP/symfony/console?
(PD: If needed, I MAY use ReactPhp to handle the event loop).
Upvotes: 0
Views: 609
Reputation: 142
Yes, you can! This is an excellent use case for ReactPHP, especially if you're looking to create something interactive and reactive. I highly recommend checking out https://github.com/clue/reactphp-stdio, as it perfectly fits your use case.
Upvotes: 1