Compare commits
13 Commits
Author | SHA1 | Date |
---|---|---|
R. Eric Wheeler | 44b3d2ce4a | |
R. Eric Wheeler | 14fa05424a | |
R. Eric Wheeler | 347a1b9456 | |
R. Eric Wheeler | 08e20d2e7a | |
R. Eric Wheeler | 76d81d5d0b | |
R. Eric Wheeler | 1a03ecde81 | |
R. Eric Wheeler | cc9ccc538b | |
R. Eric Wheeler | 8eb9cd5167 | |
R. Eric Wheeler | 1b01ff78f2 | |
R. Eric Wheeler | 5b92106e46 | |
R. Eric Wheeler | d12cd38456 | |
R. Eric Wheeler | 16b4cff214 | |
R. Eric Wheeler | ac7e8c5069 |
|
@ -18,7 +18,6 @@ before_script:
|
||||||
- php composer.phar install
|
- php composer.phar install
|
||||||
|
|
||||||
# Run our tests
|
# Run our tests
|
||||||
# If Xdebug was installed you can generate a coverage report and see code coverage metrics.
|
|
||||||
test:7.4:
|
test:7.4:
|
||||||
only:
|
only:
|
||||||
- 1.x
|
- 1.x
|
||||||
|
@ -35,3 +34,11 @@ test:8.0:
|
||||||
image: php:8.0
|
image: php:8.0
|
||||||
script:
|
script:
|
||||||
- vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never
|
- vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never
|
||||||
|
test:8.1:
|
||||||
|
only:
|
||||||
|
- 1.x
|
||||||
|
tags:
|
||||||
|
- default
|
||||||
|
image: php:8.1
|
||||||
|
script:
|
||||||
|
- vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never
|
||||||
|
|
11
README.md
11
README.md
|
@ -2,15 +2,16 @@
|
||||||
|
|
||||||
This simply uses the FFI extension to enable _getch and _ungetch in Windows and linux.
|
This simply uses the FFI extension to enable _getch and _ungetch in Windows and linux.
|
||||||
|
|
||||||
[![pipeline status](https://repos.bgemi.net/sikofitt/getch/badges/1.x/pipeline.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x)
|
[![Pipeline status](https://code.bgemi.net/olive/PHP/getch/badges/1.x/pipeline.svg)](https://code.bgemi.net/olive/PHP/getch/-/commits/1.x)
|
||||||
[![coverage report](https://repos.bgemi.net/sikofitt/getch/badges/1.x/coverage.svg)](https://repos.bgemi.net/sikofitt/getch/-/commits/1.x)
|
[![Coverage report](https://code.bgemi.net/olive/PHP/getch/badges/1.x/coverage.svg)](https://code.bgemi.net/olive/PHP/getch/-/commits/1.x)
|
||||||
|
[![Latest Release](https://code.bgemi.net/olive/PHP/getch/-/badges/release.svg)](https://code.bgemi.net/olive/PHP/getch/-/releases)
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
$ composer require sikofitt/getch:dev-master
|
$ composer require olivebbs/getch
|
||||||
```
|
```
|
||||||
|
|
||||||
```php
|
```php
|
||||||
use Sikofitt\Console\Getch;
|
use Olive\Console\Getch;
|
||||||
$g = new Getch($linuxLibrary = null); // can also be a library that implements a function called _getch;
|
$g = new Getch($linuxLibrary = null); // can also be a library that implements a function called _getch;
|
||||||
// by default uses the bundled Resources/libgetch.so
|
// by default uses the bundled Resources/libgetch.so
|
||||||
// on windows uses the built in _getch function.
|
// on windows uses the built in _getch function.
|
||||||
|
@ -45,7 +46,7 @@ Note that if you want to put a word into the STDIN stack, you need to do it in r
|
||||||
There are also helper functions called getch() and ungetch();
|
There are also helper functions called getch() and ungetch();
|
||||||
|
|
||||||
```php
|
```php
|
||||||
use function Sikofitt\Console\getch;
|
use function Olive\Console\getch;
|
||||||
$ord = getch($linuxLibrary = null);
|
$ord = getch($linuxLibrary = null);
|
||||||
print \chr($ord);
|
print \chr($ord);
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
{
|
{
|
||||||
"name": "sikofitt/getch",
|
"name": "olivebbs/getch",
|
||||||
"description": "Implements _getch and _ungetch for windows and linux using ffi",
|
"description": "Implements _getch and _ungetch for windows and linux using ffi",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
|
"keywords": ["getch", "windows", "conio", "linux", "console", "conio.h", "hotkey", "termios"],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.4",
|
"php": ">=8.0",
|
||||||
"ext-ffi": "*"
|
"ext-ffi": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "^2.18",
|
"friendsofphp/php-cs-fixer": "^3.14",
|
||||||
"jetbrains/phpstorm-stubs": "dev-master",
|
|
||||||
"phpunit/phpunit": "^9.5"
|
"phpunit/phpunit": "^9.5"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Sikofitt\\Console\\": "src/Console/"
|
"Olive\\Console\\": "src/Console/"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"functions.php"
|
"functions.php"
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Sikofitt\\Tests\\Console\\": "tests/"
|
"Olive\\Tests\\Console\\": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
|
@ -30,5 +30,8 @@
|
||||||
"name": "R. Eric Wheeler",
|
"name": "R. Eric Wheeler",
|
||||||
"email": "sikofitt@gmail.com"
|
"email": "sikofitt@gmail.com"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"conflict": {
|
||||||
|
"sikofitt/getch": "*"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,7 +12,7 @@ declare(strict_types=1);
|
||||||
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Sikofitt\Console\Getch;
|
use Olive\Console\Getch;
|
||||||
|
|
||||||
if (!function_exists('getch')) {
|
if (!function_exists('getch')) {
|
||||||
function getch(string $linuxLibrary = null): int
|
function getch(string $linuxLibrary = null): int
|
||||||
|
|
|
@ -12,7 +12,7 @@ declare(strict_types=1);
|
||||||
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Sikofitt\Console;
|
namespace Olive\Console;
|
||||||
|
|
||||||
use FFI;
|
use FFI;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Sikofitt\Tests\Console\Getch;
|
namespace Olive\Tests\Console\Getch;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Sikofitt\Console\Getch;
|
use Olive\Console\Getch;
|
||||||
|
|
||||||
class GetchTest extends TestCase
|
class GetchTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Sikofitt\Tests\Console\Ungetch;
|
namespace Olive\Tests\Console\Ungetch;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Sikofitt\Console\Getch;
|
use Olive\Console\Getch;
|
||||||
|
|
||||||
class UngetchTest extends TestCase
|
class UngetchTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue