simpl / console
The Simpl way to get up and running with a clean console project.
Requires
- phpunit/phpunit: ^9.4
- simpl/config: ^1.0
- symfony/console: ^5.1
Requires (Dev)
- squizlabs/php_codesniffer: ^3.5
- symfony/var-dumper: ^5.1
This package is auto-updated.
Last update: 2024-11-16 12:20:15 UTC
README
Boilerplate for creating a new console project using
symfony/console
.
Installation
composer create-project simpl/console [your-project-name] --stability=dev
Basic Usage
Command Help
php console help app:hello
Run the hello command.
php console app:hello
Run the hello command with optional name
parameter
php console app:hello --name="Josh"
Adding your own commands.
You can add new commands by adding a class that extends Symfony\Component\Console\Command\Command
to the app\Commands
directory.
Once you've added your command, register it in the console
script.
// ... register commands $application->add(new Commands\Hello());
See
app\Commands\Hello
for an example.
See https://simpl-php.com/components/console for full documentation.
Testing
composer test
Coding Standards
This library uses PHP_CodeSniffer to ensure coding standards are followed.
I have adopted the PHP FIG PSR-2 Coding Standard EXCEPT for the tabs vs spaces for indentation rule. PSR-2 says 4 spaces. I use tabs. No discussion.
To support indenting with tabs, I've defined a custom PSR-2 ruleset that extends the standard PSR-2 ruleset used by PHP_CodeSniffer. You can find this ruleset in the root of this project at PSR2Tabs.xml
Codesniffer
composer codensiffer
Codefixer
composer codefixer