CoolCLI is a lightweight and extensible CLI tool for executing custom commands in PHP. With CoolCLI, you can easily define your own commands and use them
- ✅ Easy Command Definition: Create your own command classes and add them to the CLI.
- ✅ Supports Arguments & Options: Define various arguments and options for your commands.
- ✅ Modular Structure: Add new commands without modifying the core CLI.
- ✅ Similar to Laravel Artisan: If you're familiar with Artisan, CoolCLI will feel intuitive.
To install CoolCLI, run the following command:
composer require wordcoolframework/cool-cliTo create a new command, add a new class in the command/ directory. For example, GreetCommand.php:
namespace Command;
final class GreetCommand {
public string $commandName = 'greet';
public string $description = 'Prints a greeting message';
public static function handle(?string $name = 'World') : void {
echo "Hello, $name!\n";
}
}Now, you can execute this command:
php cool greet
php cool greet JohnCLI settings are stored in the config.php file:
return [
"CommandNamespace" => "\\Command",
"CommandDirectory" => "/command",
];🔹 Contributions and improvements are always welcome! To contribute:
- Fork this repository.
- Create a new branch (
git checkout -b feature-name). - Commit your changes (
git commit -m 'Add some feature'). - Submit a Pull Request to the main repository.