Compare commits

...

3 Commits
2.x ... 1.5.0

Author SHA1 Message Date
R. Eric Wheeler 1b01ff78f2 Fix readme 2022-05-17 10:04:07 -07:00
R. Eric Wheeler 5b92106e46 Update readme 2022-05-17 09:53:07 -07:00
R. Eric Wheeler d12cd38456 Move to new namespace 2022-05-17 09:47:34 -07:00
7 changed files with 80 additions and 134 deletions

View File

@ -2,15 +2,16 @@
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)
[![coverage report](https://repos.bgemi.net/sikofitt/getch/badges/1.x/coverage.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://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
$ composer require sikofitt/getch:dev-master
$ composer require olivebbs/getch
```
```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;
// by default uses the bundled Resources/libgetch.so
// 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();
```php
use function Sikofitt\Console\getch;
use function Olive\Console\getch;
$ord = getch($linuxLibrary = null);
print \chr($ord);

View File

@ -1,5 +1,5 @@
{
"name": "sikofitt/getch",
"name": "olivebbs/getch",
"description": "Implements _getch and _ungetch for windows and linux using ffi",
"type": "library",
"require": {
@ -8,12 +8,11 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.18",
"jetbrains/phpstorm-stubs": "dev-master",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"Sikofitt\\Console\\": "src/Console/"
"Olive\\Console\\": "src/Console/"
},
"files": [
"functions.php"
@ -21,7 +20,7 @@
},
"autoload-dev": {
"psr-4": {
"Sikofitt\\Tests\\Console\\": "tests/"
"Olive\\Tests\\Console\\": "tests/"
}
},
"license": "MPL-2.0",

184
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bb5128ff3c57a9cb46fa7c4697fcc0bb",
"content-hash": "a9f24f3e6bdfb946f6671416016d7e76",
"packages": [],
"packages-dev": [
{
@ -552,55 +552,6 @@
],
"time": "2021-11-15T17:17:55+00:00"
},
{
"name": "jetbrains/phpstorm-stubs",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/JetBrains/phpstorm-stubs.git",
"reference": "4e756892120c49b2b9781b762a942c6e59248abe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/4e756892120c49b2b9781b762a942c6e59248abe",
"reference": "4e756892120c49b2b9781b762a942c6e59248abe",
"shasum": ""
},
"require-dev": {
"friendsofphp/php-cs-fixer": "@stable",
"nikic/php-parser": "@stable",
"php": "^8.0",
"phpdocumentor/reflection-docblock": "@stable",
"phpunit/phpunit": "@stable"
},
"default-branch": true,
"type": "library",
"autoload": {
"files": [
"PhpStormStubsMap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "PHP runtime & extensions header files for PhpStorm",
"homepage": "https://www.jetbrains.com/phpstorm",
"keywords": [
"autocomplete",
"code",
"inference",
"inspection",
"jetbrains",
"phpstorm",
"stubs",
"type"
],
"support": {
"source": "https://github.com/JetBrains/phpstorm-stubs/tree/master"
},
"time": "2022-05-06T19:57:35+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.11.0",
@ -1532,20 +1483,20 @@
},
{
"name": "psr/cache",
"version": "3.0.0",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
"php": ">=5.3.0"
},
"type": "library",
"extra": {
@ -1565,7 +1516,7 @@
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
@ -1575,33 +1526,28 @@
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/3.0.0"
"source": "https://github.com/php-fig/cache/tree/master"
},
"time": "2021-02-03T23:26:27+00:00"
"time": "2016-08-06T20:24:11+00:00"
},
{
"name": "psr/container",
"version": "2.0.2",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
"reference": "513e0666f7216c7459170d56df27dfcefe1689ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
"url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea",
"reference": "513e0666f7216c7459170d56df27dfcefe1689ea",
"shasum": ""
},
"require": {
"php": ">=7.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
@ -1628,9 +1574,9 @@
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/2.0.2"
"source": "https://github.com/php-fig/container/tree/1.1.2"
},
"time": "2021-11-05T16:47:00+00:00"
"time": "2021-11-05T16:50:12+00:00"
},
{
"name": "psr/event-dispatcher",
@ -1684,30 +1630,30 @@
},
{
"name": "psr/log",
"version": "2.0.0",
"version": "1.1.4",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "ef29f6d262798707a9edd554e2b82517ef3a9376"
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376",
"reference": "ef29f6d262798707a9edd554e2b82517ef3a9376",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "src"
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -1728,9 +1674,9 @@
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/2.0.0"
"source": "https://github.com/php-fig/log/tree/1.1.4"
},
"time": "2021-07-14T16:41:46+00:00"
"time": "2021-05-03T11:20:27+00:00"
},
{
"name": "sebastian/cli-parser",
@ -2797,25 +2743,25 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.0.1",
"version": "v2.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c"
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c",
"reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"shasum": ""
},
"require": {
"php": ">=8.0.2"
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.0-dev"
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -2844,7 +2790,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.1"
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1"
},
"funding": [
{
@ -2860,7 +2806,7 @@
"type": "tidelift"
}
],
"time": "2022-01-02T09:55:41+00:00"
"time": "2022-01-02T09:53:40+00:00"
},
{
"name": "symfony/event-dispatcher",
@ -2949,20 +2895,20 @@
},
{
"name": "symfony/event-dispatcher-contracts",
"version": "v3.0.1",
"version": "v2.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher-contracts.git",
"reference": "7bc61cc2db649b4637d331240c5346dcc7708051"
"reference": "f98b54df6ad059855739db6fcbc2d36995283fe1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051",
"reference": "7bc61cc2db649b4637d331240c5346dcc7708051",
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1",
"reference": "f98b54df6ad059855739db6fcbc2d36995283fe1",
"shasum": ""
},
"require": {
"php": ">=8.0.2",
"php": ">=7.2.5",
"psr/event-dispatcher": "^1"
},
"suggest": {
@ -2971,7 +2917,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.0-dev"
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -3008,7 +2954,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.1"
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.1"
},
"funding": [
{
@ -3024,7 +2970,7 @@
"type": "tidelift"
}
],
"time": "2022-01-02T09:55:41+00:00"
"time": "2022-01-02T09:53:40+00:00"
},
{
"name": "symfony/filesystem",
@ -3922,21 +3868,22 @@
},
{
"name": "symfony/service-contracts",
"version": "v3.0.1",
"version": "v2.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c"
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/e517458f278c2131ca9f262f8fbaf01410f2c65c",
"reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
"shasum": ""
},
"require": {
"php": ">=8.0.2",
"psr/container": "^2.0"
"php": ">=7.2.5",
"psr/container": "^1.1",
"symfony/deprecation-contracts": "^2.1|^3"
},
"conflict": {
"ext-psr": "<1.1|>=2"
@ -3947,7 +3894,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.0-dev"
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -3984,7 +3931,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v3.0.1"
"source": "https://github.com/symfony/service-contracts/tree/v2.5.1"
},
"funding": [
{
@ -4000,7 +3947,7 @@
"type": "tidelift"
}
],
"time": "2022-03-13T20:10:05+00:00"
"time": "2022-03-13T20:07:29+00:00"
},
{
"name": "symfony/stopwatch",
@ -4066,33 +4013,34 @@
},
{
"name": "symfony/string",
"version": "v6.0.8",
"version": "v5.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d"
"reference": "3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/ac0aa5c2282e0de624c175b68d13f2c8f2e2649d",
"reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d",
"url": "https://api.github.com/repos/symfony/string/zipball/3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8",
"reference": "3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8",
"shasum": ""
},
"require": {
"php": ">=8.0.2",
"php": ">=7.2.5",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-intl-grapheme": "~1.0",
"symfony/polyfill-intl-normalizer": "~1.0",
"symfony/polyfill-mbstring": "~1.0"
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php80": "~1.15"
},
"conflict": {
"symfony/translation-contracts": "<2.0"
"symfony/translation-contracts": ">=3.0"
},
"require-dev": {
"symfony/error-handler": "^5.4|^6.0",
"symfony/http-client": "^5.4|^6.0",
"symfony/translation-contracts": "^2.0|^3.0",
"symfony/var-exporter": "^5.4|^6.0"
"symfony/error-handler": "^4.4|^5.0|^6.0",
"symfony/http-client": "^4.4|^5.0|^6.0",
"symfony/translation-contracts": "^1.1|^2",
"symfony/var-exporter": "^4.4|^5.0|^6.0"
},
"type": "library",
"autoload": {
@ -4131,7 +4079,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v6.0.8"
"source": "https://github.com/symfony/string/tree/v5.4.8"
},
"funding": [
{
@ -4147,7 +4095,7 @@
"type": "tidelift"
}
],
"time": "2022-04-22T08:18:02+00:00"
"time": "2022-04-19T10:40:37+00:00"
},
{
"name": "theseer/tokenizer",
@ -4260,9 +4208,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"jetbrains/phpstorm-stubs": 20
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {

View File

@ -12,7 +12,7 @@ declare(strict_types=1);
* You can obtain one at https://mozilla.org/MPL/2.0/.
*/
use Sikofitt\Console\Getch;
use Olive\Console\Getch;
if (!function_exists('getch')) {
function getch(string $linuxLibrary = null): int

View File

@ -12,7 +12,7 @@ declare(strict_types=1);
* You can obtain one at https://mozilla.org/MPL/2.0/.
*/
namespace Sikofitt\Console;
namespace Olive\Console;
use FFI;
use RuntimeException;

View File

@ -1,9 +1,9 @@
<?php
namespace Sikofitt\Tests\Console\Getch;
namespace Olive\Tests\Console\Getch;
use PHPUnit\Framework\TestCase;
use Sikofitt\Console\Getch;
use Olive\Console\Getch;
class GetchTest extends TestCase
{

View File

@ -1,9 +1,9 @@
<?php
namespace Sikofitt\Tests\Console\Ungetch;
namespace Olive\Tests\Console\Ungetch;
use PHPUnit\Framework\TestCase;
use Sikofitt\Console\Getch;
use Olive\Console\Getch;
class UngetchTest extends TestCase
{