Skip to content

Commit c381de5

Browse files
committed
Upgrade hyperf version to v2.1
1 parent c84530e commit c381de5

File tree

8 files changed

+51
-54
lines changed

8 files changed

+51
-54
lines changed

.github/workflows/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# @link https://www.hyperf.io
44
# @document https://hyperf.wiki
55
6-
# @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
6+
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
77

8-
FROM hyperf/hyperf:7.4-alpine-v3.11-cli
8+
FROM hyperf/hyperf:7.4-alpine-v3.11-swoole
99
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT" app.name="Hyperf"
1010

1111
##
@@ -15,17 +15,11 @@ LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MI
1515
ARG timezone
1616

1717
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
18-
COMPOSER_VERSION=1.10.10 \
1918
APP_ENV=prod \
2019
SCAN_CACHEABLE=(true)
2120

2221
# update
2322
RUN set -ex \
24-
# install composer
25-
&& cd /tmp \
26-
&& wget https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar \
27-
&& chmod u+x composer.phar \
28-
&& mv composer.phar /usr/local/bin/composer \
2923
# show php version and extensions
3024
&& php -v \
3125
&& php -m \

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ vendor/
1010
.env
1111
.DS_Store
1212
*.lock
13-
.phpunit*
13+
.phpunit*
14+
*.cache

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# @link https://www.hyperf.io
44
# @document https://hyperf.wiki
55
6-
# @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
6+
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
77

88
FROM hyperf/hyperf:7.4-alpine-v3.11-swoole
99
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT" app.name="Hyperf"

bin/hyperf.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
// Self-called anonymous function that creates its own scope and keep the global namespace clean.
1616
(function () {
1717
Hyperf\Di\ClassLoader::init();
18-
/** @var \Psr\Container\ContainerInterface $container */
18+
/** @var Psr\Container\ContainerInterface $container */
1919
$container = require BASE_PATH . '/config/container.php';
2020

21-
$application = $container->get(\Hyperf\Contract\ApplicationInterface::class);
21+
$application = $container->get(Hyperf\Contract\ApplicationInterface::class);
2222
$application->run();
2323
})();

composer.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,25 @@
1212
"description": "A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.",
1313
"license": "Apache-2.0",
1414
"require": {
15-
"php": ">=7.2",
16-
"ext-swoole": ">=4.5",
17-
"hyperf/cache": "~2.0.0",
18-
"hyperf/command": "~2.0.0",
19-
"hyperf/config": "~2.0.0",
20-
"hyperf/db-connection": "~2.0.0",
21-
"hyperf/framework": "~2.0.0",
22-
"hyperf/guzzle": "~2.0.0",
23-
"hyperf/http-server": "~2.0.0",
24-
"hyperf/logger": "~2.0.0",
25-
"hyperf/memory": "~2.0.0",
26-
"hyperf/process": "~2.0.0",
27-
"hyperf/redis": "~2.0.0"
15+
"php": ">=7.3",
16+
"hyperf/cache": "~2.1.0",
17+
"hyperf/command": "~2.1.0",
18+
"hyperf/config": "~2.1.0",
19+
"hyperf/db-connection": "~2.1.0",
20+
"hyperf/framework": "~2.1.0",
21+
"hyperf/guzzle": "~2.1.0",
22+
"hyperf/http-server": "~2.1.0",
23+
"hyperf/logger": "~2.1.0",
24+
"hyperf/memory": "~2.1.0",
25+
"hyperf/process": "~2.1.0"
2826
},
2927
"require-dev": {
3028
"swoole/ide-helper": "^4.5",
3129
"friendsofphp/php-cs-fixer": "^2.14",
3230
"mockery/mockery": "^1.0",
3331
"phpstan/phpstan": "^0.12",
34-
"hyperf/devtool": "~2.0.0",
35-
"hyperf/testing": "~2.0.0"
32+
"hyperf/devtool": "~2.1.0",
33+
"hyperf/testing": "~2.1.0"
3634
},
3735
"suggest": {
3836
"ext-openssl": "Required to use HTTPS.",
@@ -56,8 +54,11 @@
5654
},
5755
"minimum-stability": "dev",
5856
"prefer-stable": true,
59-
"extra": {
57+
"config": {
58+
"optimize-autoloader": true,
59+
"sort-packages": true
6060
},
61+
"extra": {},
6162
"scripts": {
6263
"pre-install-cmd": "Installer\\Script::install",
6364
"pre-update-cmd": "Installer\\Script::install",

config/autoload/server.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
1111
*/
1212
use Hyperf\Server\Server;
13-
use Hyperf\Server\SwooleEvent;
13+
use Hyperf\Server\Event;
1414

1515
return [
1616
'mode' => SWOOLE_PROCESS,
@@ -22,7 +22,7 @@
2222
'port' => 9501,
2323
'sock_type' => SWOOLE_SOCK_TCP,
2424
'callbacks' => [
25-
SwooleEvent::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
25+
Event::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
2626
],
2727
],
2828
],
@@ -38,8 +38,8 @@
3838
'buffer_output_size' => 2 * 1024 * 1024,
3939
],
4040
'callbacks' => [
41-
SwooleEvent::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
42-
SwooleEvent::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
43-
SwooleEvent::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
41+
Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
42+
Event::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
43+
Event::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
4444
],
4545
];

installer/config.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,61 +12,61 @@
1212
return [
1313
'packages' => [
1414
'hyperf/amqp' => [
15-
'version' => '~2.0.0',
15+
'version' => '~2.1.0',
1616
],
1717
'hyperf/async-queue' => [
18-
'version' => '~2.0.0',
18+
'version' => '~2.1.0',
1919
],
2020
'hyperf/database' => [
21-
'version' => '~2.0.0',
21+
'version' => '~2.1.0',
2222
],
2323
'hyperf/db-connection' => [
24-
'version' => '~2.0.0',
24+
'version' => '~2.1.0',
2525
],
2626
'hyperf/model-cache' => [
27-
'version' => '~2.0.0',
27+
'version' => '~2.1.0',
2828
],
2929
'hyperf/constants' => [
30-
'version' => '~2.0.0',
30+
'version' => '~2.1.0',
3131
],
3232
'hyperf/json-rpc' => [
33-
'version' => '~2.0.0',
33+
'version' => '~2.1.0',
3434
],
3535
'hyperf/redis' => [
36-
'version' => '~2.0.0',
36+
'version' => '~2.1.0',
3737
],
3838
'hyperf/rpc' => [
39-
'version' => '~2.0.0',
39+
'version' => '~2.1.0',
4040
],
4141
'hyperf/rpc-client' => [
42-
'version' => '~2.0.0',
42+
'version' => '~2.1.0',
4343
],
4444
'hyperf/rpc-server' => [
45-
'version' => '~2.0.0',
45+
'version' => '~2.1.0',
4646
],
4747
'hyperf/grpc-client' => [
48-
'version' => '~2.0.0',
48+
'version' => '~2.1.0',
4949
],
5050
'hyperf/grpc-server' => [
51-
'version' => '~2.0.0',
51+
'version' => '~2.1.0',
5252
],
5353
'hyperf/elasticsearch' => [
54-
'version' => '~2.0.0',
54+
'version' => '~2.1.0',
5555
],
5656
'hyperf/config-apollo' => [
57-
'version' => '~2.0.0',
57+
'version' => '~2.1.0',
5858
],
5959
'hyperf/config-aliyun-acm' => [
60-
'version' => '~2.0.0',
60+
'version' => '~2.1.0',
6161
],
6262
'hyperf/config-etcd' => [
63-
'version' => '~2.0.0',
63+
'version' => '~2.1.0',
6464
],
6565
'hyperf/tracer' => [
66-
'version' => '~2.0.0',
66+
'version' => '~2.1.0',
6767
],
6868
'hyperf/service-governance' => [
69-
'version' => '~2.0.0',
69+
'version' => '~2.1.0',
7070
],
7171
],
7272
'require-dev' => [

installer/resources/bin/hyperf.stub

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
ini_set('display_errors', 'on');
55
ini_set('display_startup_errors', 'on');
6+
ini_set('memory_limit', '1G');
67

78
error_reporting(E_ALL);
89
date_default_timezone_set('%TIME_ZONE%');
@@ -15,9 +16,9 @@ require BASE_PATH . '/vendor/autoload.php';
1516
// Self-called anonymous function that creates its own scope and keep the global namespace clean.
1617
(function () {
1718
Hyperf\Di\ClassLoader::init();
18-
/** @var \Psr\Container\ContainerInterface $container */
19+
/** @var Psr\Container\ContainerInterface $container */
1920
$container = require BASE_PATH . '/config/container.php';
2021

21-
$application = $container->get(\Hyperf\Contract\ApplicationInterface::class);
22+
$application = $container->get(Hyperf\Contract\ApplicationInterface::class);
2223
$application->run();
2324
})();

0 commit comments

Comments
 (0)