Cli-maker is library for automatically generating cli commands from any PHP class.
This library requires PHP 7
composer require wilgucki/cli-maker
Create on root level of your application cli-maker.php file. Future version of this library will allow you to choose location of this file.
Add all class names you want to access from command line into this file. Currently library requires all class names to be unique (even if classes are using different namespaces). This will change in future version.
<?php // cli-maker.php return [ \App\Namespace\Foo::class, \App\Another\Namespace\Bar::class, ];
To list all available commands run
To run single command simply add it after cli-maker script.
If converted method accepts parameters, you can add them in the same order as they were defined in your method. If you want to check those parameters you can use --help option.
./vendor/bin/cli-maker foo:bar --help
- pass array as argument
- allow to customise config location
- get method description from phpdoc
- make method names unique
- write tests
- check if class is accessible