Download the PHP package matthiasnoback/symfony-console-form without Composer
On this page you can find all versions of the php package matthiasnoback/symfony-console-form. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download matthiasnoback/symfony-console-form
More information about matthiasnoback/symfony-console-form
Files in matthiasnoback/symfony-console-form
Package symfony-console-form
Short Description Use Symfony forms for Console command input
License MIT
Homepage http://github.com/matthiasnoback/symfony-console-form
Informations about the package symfony-console-form
Symfony Console Form
By Matthias Noback
This package contains a Symfony bundle and some tools which enable you to use Symfony Form types to define and interactively process user input from the CLI.
Installation
composer require matthiasnoback/symfony-console-form
Enable Matthias\SymfonyConsoleForm\Bundle\SymfonyConsoleFormBundle
in the kernel of your Symfony application.
Usage
Follow the steps below or just clone this project, then run:
php test/console.php form:demo
Set up the form
The corresponding Demo
class looks like this:
Create the console command; use the form
helper
When you provide command-line options with the names of the form fields, those values will be used as default values.
If you add the --no-interaction
option when running the command, it will submit the form using the input options you provided.
If the submitted data is invalid the command will fail.
Using simpler forms with custom names
Nested Forms
If you have a complex compound form, you can define options and reference form children using square brackets:
TODO
- Maybe: provide a way to submit a form at once, possibly using a JSON-encoded array
- Add more functional tests
- Show form label of root form
- Show nesting in form hierarchy using breadcrumbs
- When these things have been provided, release this as a package (or multiple packages for stand-alone use)
All versions of symfony-console-form with dependencies
symfony/form Version ~5.4 || ~6.0 || ~7.0
symfony/console Version ~5.4 || ~6.0 || ~7.0
symfony/translation Version ~5.4 || ~6.0 || ~7.0