1. Go to this page and download the library: Download bauhaus/cli library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bauhaus / cli example snippets
useBauhaus\Cli;
useBauhaus\CliSettings;
useBauhaus\Cli\Entrypoint;
useBauhaus\Cli\Input;
useBauhaus\Cli\Output;
useBauhaus\Cli\Processor\Middleware;
useBauhaus\Cli\Attribute\Name;
useBauhaus\Cli\Processor\Handler;
#[Name('command-id')]classMyCliEntrypointimplementsEntrypoint{
publicfunctionexecute(Input $input, Output $output): void{
$output->write("my entrypoing\n");
}
}
classMyCliMiddlewareimplementsMiddleware{
publicfunctionexecute(Input $input,Output $output, Handler $next): void{
$output->write("my middleware\n");
$next->execute($input, $output);
}
}
$settings = CliSettings::default()
->withOutput('/var/tmp/file') // default is php://stdout
->withEntrypoints(
new MyCliEntrypoint(),
)
->withMiddlewares(
new MyCliMiddleware(),
);
$cliApplication = Cli::bootstrap($settings);
$cliApplication->run('./bin', 'command-id'); // it could be $cliApplication->run($_SERVER['argv']);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.