Download the PHP package fidry/console without Composer
On this page you can find all versions of the php package fidry/console. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fidry/console
More information about fidry/console
Files in fidry/console
Informations about the package console
Console
Motivation: this library purpose is to provide a lighter and more robust API for console commands and/or applications to symfony/console.
It can be used either in combination with FrameworkBundle
to
facilitate the creation of commands or as a stand-alone package to create a CLI
application app.
Key differences:
- Leverages an
IO
object instead of Input + Output + SymfonyStyle which offers:- The API of SymfonyStyle but still access to the Input and Output objects
- A typed API for arguments and options (the input is validated when coercing it to a stricter type)
- Implement explicit interfaces instead of extending god classes
Table of Contents
- Installation with Symfony
- Usage preview
- Complete documentation
- Command
- Creating a command
- Configuring the Command
- Registering the Command
- Executing the Command
- Console Output
- Output Sections
- Console Input
- Getting Services from the Service Container
- Command Lifecycle
- Testing Commands
- Logging Command Errors
- Learn More
- How to Call Other Commands
- How to Make Commands Lazily Loaded
- Application
- Creating an application
- Executing an Application
- Testing
- Testing an Application
- Testing a Command
- Command
- Known Limitations
- Inspirations
- Contributing
Installation with Symfony
The Symfony Flex plugin should add the following:
Usage preview
To implement a command you have to implement the Fidry\Console\Command\Command
interface as
follows:
With the bundle enabled, those services are auto-configured into traditional Symfony commands.
Known limitations
Some limitations are due to lack of time dedicated to those or based on the assumption they are not necessary. Those choices may be revisited depending on of the use case presented.
- Support for hidden commands (see doc)
- Support for command aliases
- Support for command usage configuration
- Some obscure methods of
Application
Inspirations
- zenstruck/console-extra
- zenstruck/console-test
- webignition/symfony-console-typed-input
- webmozart-console
Contributing
The project provides a Makefile
in which the most common commands have been
registered such as fixing the coding style or running the test.
All versions of console with dependencies
psr/log Version ^3.0
symfony/console Version ^6.4 || ^7.0
symfony/deprecation-contracts Version ^3.4
symfony/event-dispatcher-contracts Version ^2.5 || ^3.0
symfony/service-contracts Version ^2.5 || ^3.0
thecodingmachine/safe Version ^2.0
webmozart/assert Version ^1.11