nano
nano copied to clipboard
安装 php-cs-fixer 和 phpstan 之后无法 ctrl + c 退出进程
环境
- PHP
$ php -v
PHP 8.1.4 (cli) (built: Mar 18 2022 09:46:02) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies
with Zend OPcache v8.1.4, Copyright (c), by Zend Technologies
- Swoole
$ php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.8.10
Built => Jul 16 2022 13:16:55
coroutine => enabled with boost asm context
kqueue => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1p 21 Jun 2022
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
zlib => 1.2.11
brotli => E16777225/D16777225
mysqlnd => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => Off => Off
swoole.unixsock_buffer_size => 262144 => 262144
- Hyperf
$ composer info|grep hyperf
hyperf/command dev-master 525abc7 Command for hyperf
hyperf/config dev-master 9344eb2 An independent component that provides configuration container.
hyperf/context dev-master a072131 A coroutine context library.
hyperf/contract dev-master c8e7aa0 The contracts of Hyperf.
hyperf/coordinator dev-master 5c08f65 Hyperf Coordinator
hyperf/di dev-master 99062a6 A DI for Hyperf.
hyperf/dispatcher dev-master b680b15 A HTTP Server for Hyperf.
hyperf/engine 1.3.x-dev b94510c
hyperf/event dev-master d9950a0 an event manager that implements PSR-14.
hyperf/exception-handler dev-master e27e373 Exception handler for hyperf
hyperf/framework dev-master 09c4981 A coroutine framework that focuses on hyperspeed and flexible, ...
hyperf/http-message dev-master f64a2aa microservice framework base on swoole
hyperf/http-server dev-master d3e1faf A HTTP Server for Hyperf.
hyperf/macroable dev-master bfd332f Hyperf Macroable package which come from illuminate/macroable
hyperf/nano dev-master b99a7cf Scale Hyperf application down to a single file
hyperf/server dev-master 467d400 A base server library for Hyperf.
hyperf/utils dev-master 00f17d8 A tools package that could help developer solved the problem qu...
复现步骤
- 创建 nano 应用
{
"require": {
"hyperf/nano": "dev-master"
},
"minimum-stability": "dev"
}
composer install 安装 hyperf/nano
- 创建入口文件(readme 的代码)
<?php
use Hyperf\Nano\Factory\AppFactory;
require_once __DIR__ . '/vendor/autoload.php';
$app = AppFactory::create();
$app->get('/', function () {
$user = $this->request->input('user', 'nano');
$method = $this->request->getMethod();
return [
'message' => "hello {$user}",
'method' => $method,
];
});
$app->run();
-
运行
php app.php start,然后ctrl + c能正常退出 -
安装
php-cs-fixer和phpstan
composer require friendsofphp/php-cs-fixer:^3.0 --dev
composer require phpstan/phpstan:^1.0 --dev
- 运行
php app.php start,ctrl + c能无法正常退出