Recommend this page to a friend! |
![]() |
Info | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2025-04-08 (3 days ago) ![]() | Not yet rated by the users | Total: Not yet counted | Not yet ranked |
Version | License | PHP version | Categories | |||
parexcommander 1.0 | MIT/X Consortium ... | 8 | Console, Parsers, PHP 8 |
Description | Author | |||||||||||||
This package can run console programs using callback functions. |
|
Parex Commander is a lightweight PHP library designed to simplify the creation of interactive CLI applications. It provides a structured and intuitive way to define commands, handle input/output, and manage the overall flow of your application.
Built on top of the Parex library.
You can install Parex Commander via Composer:
bash composer require lawondyss/parex-commander
ParexCommander
The ParexCommander
class is the heart of your CLI application. It's responsible for:
Example:
// Handlers
function day(DynamicResult $result, IO $io): void { $io->writeLn('??'); }
function night(DynamicResult $result, IO $io): void { $io->writeLn('?'); }
// Commands of Day & Night application
$commander = new ParexCommander('Day & Night', 'Something small and simple');
$commander->addCommand('day', day(...));
$commander->addCommand('night', night(...));
$commander->run();
See example for more.
Command
The Command
class represents a single command within your application. It allows you to:
Example:
$commander->addCommand('migrate', migrate(...), 'Run missing migrations.')
->addOptional('id', help: 'Specifies a particular migration.', multiple: true)
->addFlag('dry-run', help: 'It simulates running the migration, but does not execute SQL.');
Or you can use the class on its own, see example for more.
IO
The IO
class provides a simple and consistent way to interact with the user. It handles:
Better see example.
All examples are executable, just try them out ?
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Example | Example script | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | |||||||
100% |
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.