https://github.com/bauhausphp/cli
https://github.com/bauhausphp/cli
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bauhausphp/cli
- Owner: bauhausphp
- License: mit
- Created: 2021-04-07T12:44:49.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-01-16T14:03:25.000Z (over 3 years ago)
- Last Synced: 2024-12-26T20:28:07.843Z (over 1 year ago)
- Language: PHP
- Size: 45.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cli
```php
write("my entrypoing\n");
}
}
class MyCliMiddleware implements Middleware
{
public function execute(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']);
```