Browse Source

Updating to Hamlet 3.1 (#4113)

vka 6 years ago
parent
commit
a1438ec1b5

+ 1 - 1
frameworks/PHP/hamlet/Benchmark/Application.php

@@ -6,8 +6,8 @@ use Benchmark\Entities\PlainTextEntity;
 use Benchmark\Resources\DbResource;
 use Benchmark\Resources\FortuneResource;
 use Benchmark\Resources\UpdateResource;
-use Cache\Adapter\Void\VoidCachePool;
 use Hamlet\Applications\AbstractApplication;
+use Hamlet\Cache\VoidCachePool;
 use Hamlet\Database\Database;
 use Hamlet\Entities\JsonEntity;
 use Hamlet\Requests\Request;

+ 2 - 2
frameworks/PHP/hamlet/composer.json

@@ -1,7 +1,7 @@
 {
   "require": {
-    "hamlet/hamlet-core" : "^3",
-    "cache/void-adapter": "^1",
+    "hamlet/hamlet-core" : "3.1.*",
+    "cache/adapter-common": "^1",
     "react/http": "*",
     "swoft/swoole-ide-helper": "*"
   },

+ 2 - 3
frameworks/PHP/hamlet/index.php

@@ -2,6 +2,5 @@
 
 require_once __DIR__ . '/vendor/autoload.php';
 
-\Hamlet\Bootstraps\ServerBootstrap::run(function () {
-    return new \Benchmark\Application;
-});
+$application = new \Benchmark\Application;
+\Hamlet\Bootstraps\ServerBootstrap::run($application);

+ 2 - 3
frameworks/PHP/hamlet/react.php

@@ -2,6 +2,5 @@
 
 require_once __DIR__ . '/vendor/autoload.php';
 
-\Hamlet\Bootstraps\ReactBootstrap::run('0.0.0.0:8080', function () {
-    return new \Benchmark\Application;
-});
+$application = new \Benchmark\Application;
+\Hamlet\Bootstraps\ReactBootstrap::run('0.0.0.0', 8080, $application);

+ 2 - 9
frameworks/PHP/hamlet/swoole.php

@@ -1,13 +1,6 @@
 <?php
 
-use Swoole\Http\Server;
-
 require_once __DIR__ . '/vendor/autoload.php';
 
-\Hamlet\Bootstraps\SwooleBootstrap::run('0.0.0.0', 8080, function () {
-    return new \Benchmark\Application;
-}, function (Server $server) {
-    $server->set([
-        'worker_num' => NUMCORES
-    ]);
-});
+$application = new \Benchmark\Application;
+\Hamlet\Bootstraps\SwooleBootstrap::run('0.0.0.0', 8080, $application);