Skip to content

Commit f6eb705

Browse files
authored
Merge pull request #40 from hyperf/2.0-dev
Upgrade skeleton from 1.1 to 2.0
2 parents 75f35b1 + 4509bbc commit f6eb705

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+85
-116
lines changed

.php_cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file is part of Hyperf.
66
@link https://www.hyperf.io
77
@document https://doc.hyperf.io
88
9-
@license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
9+
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
1010
EOF;
1111

1212
return PhpCsFixer\Config::create()
@@ -62,11 +62,13 @@ return PhpCsFixer\Config::create()
6262
'multiline_whitespace_before_semicolons' => [
6363
'strategy' => 'no_multi_line',
6464
],
65+
'constant_case' => [
66+
'case' => 'lower',
67+
],
6568
'class_attributes_separation' => true,
6669
'combine_consecutive_unsets' => true,
6770
'declare_strict_types' => true,
6871
'linebreak_after_opening_tag' => true,
69-
'lowercase_constants' => true,
7072
'lowercase_static_reference' => true,
7173
'no_useless_else' => true,
7274
'no_unused_imports' => true,

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
77

88
FROM hyperf/hyperf:7.2-alpine-v3.9-cli
9-
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT"
9+
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT" app.name="Hyperf"
1010

1111
##
1212
# ---------- env settings ----------
@@ -16,7 +16,8 @@ ARG timezone
1616

1717
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
1818
COMPOSER_VERSION=1.9.1 \
19-
APP_ENV=prod
19+
APP_ENV=prod \
20+
SCAN_CACHEABLE=(true)
2021

2122
# update
2223
RUN set -ex \
@@ -29,6 +30,7 @@ RUN set -ex \
2930
# show php version and extensions
3031
&& php -v \
3132
&& php -m \
33+
&& php --ri swoole \
3234
# ---------- some config ----------
3335
&& cd /etc/php7 \
3436
# - config PHP
@@ -37,7 +39,7 @@ RUN set -ex \
3739
echo "post_max_size=108M"; \
3840
echo "memory_limit=1024M"; \
3941
echo "date.timezone=${TIMEZONE}"; \
40-
} | tee conf.d/99-overrides.ini \
42+
} | tee conf.d/99_overrides.ini \
4143
# - config timezone
4244
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
4345
&& echo "${TIMEZONE}" > /etc/timezone \
@@ -52,7 +54,7 @@ WORKDIR /opt/www
5254
# RUN composer install --no-dev --no-scripts
5355

5456
COPY . /opt/www
55-
RUN composer install --no-dev -o
57+
RUN composer install --no-dev -o && php bin/hyperf.php
5658

5759
EXPOSE 9501
5860

app/Controller/AbstractController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
* @link https://www.hyperf.io
88
* @document https://doc.hyperf.io
99
* @contact [email protected]
10-
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
1111
*/
12-
1312
namespace App\Controller;
1413

1514
use Hyperf\Di\Annotation\Inject;

app/Controller/IndexController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
* @link https://www.hyperf.io
88
* @document https://doc.hyperf.io
99
* @contact [email protected]
10-
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
1111
*/
12-
1312
namespace App\Controller;
1413

1514
class IndexController extends AbstractController

app/Exception/Handler/AppExceptionHandler.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* @contact [email protected]
1010
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
1111
*/
12-
1312
namespace App\Exception\Handler;
1413

1514
use Hyperf\Contract\StdoutLoggerInterface;
@@ -34,7 +33,7 @@ public function handle(Throwable $throwable, ResponseInterface $response)
3433
{
3534
$this->logger->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile()));
3635
$this->logger->error($throwable->getTraceAsString());
37-
return $response->withHeader("Server", "Hyperf")->withStatus(500)->withBody(new SwooleStream('Internal Server Error.'));
36+
return $response->withHeader('Server', 'Hyperf')->withStatus(500)->withBody(new SwooleStream('Internal Server Error.'));
3837
}
3938

4039
public function isValid(Throwable $throwable): bool

app/Listener/DbQueryExecutedListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
* @link https://www.hyperf.io
88
* @document https://doc.hyperf.io
99
* @contact [email protected]
10-
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
1111
*/
12-
1312
namespace App\Listener;
1413

1514
use Hyperf\Database\Events\QueryExecuted;

app/Model/Model.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
* @link https://www.hyperf.io
88
* @document https://doc.hyperf.io
99
* @contact [email protected]
10-
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
1111
*/
12-
1312
namespace App\Model;
1413

1514
use Hyperf\DbConnection\Model\Model as BaseModel;

bin/hyperf.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
// Self-called anonymous function that creates its own scope and keep the global namespace clean.
1515
(function () {
16+
Hyperf\Di\ClassLoader::init();
1617
/** @var \Psr\Container\ContainerInterface $container */
1718
$container = require BASE_PATH . '/config/container.php';
1819

composer.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@
1313
"license": "Apache-2.0",
1414
"require": {
1515
"php": ">=7.2",
16-
"ext-swoole": ">=4.4",
17-
"hyperf/cache": "~1.1.0",
18-
"hyperf/command": "~1.1.0",
19-
"hyperf/config": "~1.1.0",
20-
"hyperf/db-connection": "~1.1.0",
21-
"hyperf/framework": "~1.1.0",
22-
"hyperf/guzzle": "~1.1.0",
23-
"hyperf/http-server": "~1.1.0",
24-
"hyperf/logger": "~1.1.0",
25-
"hyperf/memory": "~1.1.0",
26-
"hyperf/process": "~1.1.0",
27-
"hyperf/redis": "~1.1.0"
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"
2828
},
2929
"require-dev": {
3030
"swoole/ide-helper": "^4.4",
3131
"phpmd/phpmd": "^2.6",
3232
"friendsofphp/php-cs-fixer": "^2.14",
3333
"mockery/mockery": "^1.0",
3434
"doctrine/common": "^2.9",
35-
"phpstan/phpstan": "^0.11.2",
36-
"hyperf/devtool": "~1.1.0",
37-
"hyperf/testing": "~1.1.0"
35+
"phpstan/phpstan": "^0.12",
36+
"hyperf/devtool": "~2.0.0",
37+
"hyperf/testing": "~2.0.0"
3838
},
3939
"suggest": {
4040
"ext-openssl": "Required to use HTTPS.",
@@ -67,7 +67,7 @@
6767
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
6868
],
6969
"post-autoload-dump": [
70-
"init-proxy.sh"
70+
"rm -rf runtime/container"
7171
],
7272
"test": "co-phpunit -c phpunit.xml --colors=always",
7373
"cs-fix": "php-cs-fixer fix $1",

config/autoload/annotations.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
* @link https://www.hyperf.io
88
* @document https://doc.hyperf.io
99
* @contact [email protected]
10-
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
1111
*/
12-
1312
return [
1413
'scan' => [
1514
'paths' => [

0 commit comments

Comments
 (0)