Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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()`.