Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 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 (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-13T11:52:32.000Z (almost 2 years ago)
- Last Synced: 2024-10-13T13:07:58.526Z (4 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 [![Build Status](https://github.com/mpyw/streamable-console/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/mpyw/streamable-console/actions) [![Coverage Status](https://coveralls.io/repos/github/mpyw/streamable-console/badge.svg?branch=master)](https://coveralls.io/github/mpyw/streamable-console?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mpyw/streamable-console/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mpyw/streamable-console/?branch=master)
Call interactive artisan command using arbitrary stream.
## Requirements
- PHP: `^8.0`
- Laravel: `^9.0 || ^10.0`
- [guzzlehttp/psr7](https://github.com/guzzle/psr7): `^1.7`## 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()`.