https://github.com/mpyw/streamable-console
Call interactive artisan command using arbitrary stream instead of STDIN.
https://github.com/mpyw/streamable-console
artisan artisan-command automated automation cli command console laravel php psr-7 stream
Last synced: 2 months ago
JSON representation
Call interactive artisan command using arbitrary stream instead of STDIN.
- Host: GitHub
- URL: https://github.com/mpyw/streamable-console
- Owner: mpyw
- License: mit
- Created: 2019-12-28T08:37:54.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-13T11:52:32.000Z (over 2 years ago)
- Last Synced: 2024-10-13T13:07:58.526Z (9 months ago)
- Topics: artisan, artisan-command, automated, automation, cli, command, console, laravel, php, psr-7, stream
- Language: PHP
- Homepage:
- Size: 27.3 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Streamable Console [](https://github.com/mpyw/streamable-console/actions) [](https://coveralls.io/github/mpyw/streamable-console?branch=master)
Call interactive artisan command using arbitrary stream.
## Requirements
- PHP: `^8.2`
- Laravel: `^11.0 || ^12.0`
- [guzzlehttp/psr7](https://github.com/guzzle/psr7): `^2.7`> [!NOTE]
> Older versions have outdated dependency requirements. If you cannot prepare the latest environment, please refer to past releases.## Installing
```bash
composer require mpyw/streamable-console
```## Usage
### Using Stream
```php
confirm('Is one plus one equals to three?', true)) {
return 1;
}
return 0;
}
}
``````php
usingInputStream("no\n")->call('example:quiz');
}
}
```### Using Infinite Input (`yes` command emulation)
```php
confirm('Is one plus one equals to three?', true)) {
return 1;
}
if ($this->confirm('Is one plus one equals to three?', true)) {
return 1;
}
if ($this->confirm('Is one plus one equals to three?', true)) {
return 1;
}
return 0;
}
}
``````php
usingInfiniteInput("no\n")->call('example:quiz');
}
}
```Note that you can use `yes()` as an alias of `usingInfiniteInput()`.