https://github.com/diversen/minimal-cli-framework
A small and simple CLI framework for PHP
https://github.com/diversen/minimal-cli-framework
cli-framework php php-cli-framework php-console php-console-framework
Last synced: 3 months ago
JSON representation
A small and simple CLI framework for PHP
- Host: GitHub
- URL: https://github.com/diversen/minimal-cli-framework
- Owner: diversen
- Created: 2016-12-10T11:58:50.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2023-05-05T11:29:14.000Z (over 2 years ago)
- Last Synced: 2025-08-13T14:46:03.469Z (5 months ago)
- Topics: cli-framework, php, php-cli-framework, php-console, php-console-framework
- Language: PHP
- Homepage:
- Size: 79.1 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# minimal-cli-framework
A simple CLI framework with options for multiple sub-commands
loaded as classes. In order to implement a command into an
exisiting class you will just need to add two methods: `getCommand` and
`runCommand` - and then add the object or the class to an instance
of the class `MinimalCli`.
# Install:
composer require diversen/minimal-cli-framework
# Example usage
[src/EchoTest.php](src/EchoTest.php) is a command class
containing a single command `echo` and a couple of options.
This command is added to a simple program in [demos/example.php](demos/example.php)
In order to get help on the usage of the command `echo`:
php demos/example.php echo --help
Put a file in uppercase:
php demos/example.php echo --up README.md
Or (shorthand):
php demos/example.php echo -u README.md
Which also will output the file in uppercase
# Utils
Some common CLI Utils.
See [demos/utils_test.php](demos/utils_test.php)
php demos/utils_test.php
Colors are supported with [https://github.com/php-parallel-lint/PHP-Console-Color](https://github.com/php-parallel-lint/PHP-Console-Color)
License: MIT