Skip to content

Commit cd4ddce

Browse files
committed
drop support for Laravel 5.4 and require swoole 4.3.1
1 parent fb6c738 commit cd4ddce

File tree

5 files changed

+15
-29
lines changed

5 files changed

+15
-29
lines changed

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,22 @@ sudo: false
44

55
matrix:
66
include:
7-
- php: 7.2
8-
env: FRAMEWORK_VERSION=laravel/framework:5.4.*
97
- php: 7.2
108
env: FRAMEWORK_VERSION=laravel/framework:5.5.*
119
- php: 7.2
1210
env: FRAMEWORK_VERSION=laravel/framework:5.6.*
1311
- php: 7.2
1412
env: FRAMEWORK_VERSION=laravel/framework:5.7.*
15-
# - php: 7.2
16-
# env: FRAMEWORK_VERSION=laravel/framework:5.8.*
1713
- php: 7.2
18-
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.4.*
14+
env: FRAMEWORK_VERSION=laravel/framework:5.8.*
1915
- php: 7.2
2016
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.5.*
2117
- php: 7.2
2218
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.6.*
2319
- php: 7.2
2420
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.7.*
21+
- php: 7.2
22+
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.8.*
2523

2624
before_install:
2725
- printf "\n" | pecl install swoole

routes/lumen_routes.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,5 @@
1111
|
1212
*/
1313

14-
$app->get('socket.io', [
15-
'as' => 'io.get', 'uses' => 'SocketIOController@upgrade',
16-
]);
17-
18-
$app->post('socket.io', [
19-
'as' => 'io.post', 'uses' => 'SocketIOController@reject',
20-
]);
14+
$router->get('socket.io', ['uses' => 'SocketIOController@upgrade']);
15+
$router->post('socket.io', ['uses' => 'SocketIOController@reject']);

src/Commands/HttpServerCommand.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
use Throwable;
66
use Swoole\Process;
77
use Illuminate\Support\Arr;
8+
use SwooleTW\Http\Helpers\OS;
89
use Illuminate\Console\Command;
910
use SwooleTW\Http\Server\Manager;
1011
use Illuminate\Console\OutputStyle;
1112
use SwooleTW\Http\HotReload\FSEvent;
12-
use SwooleTW\Http\Server\AccessOutput;
1313
use SwooleTW\Http\HotReload\FSOutput;
1414
use SwooleTW\Http\HotReload\FSProcess;
15+
use SwooleTW\Http\Server\AccessOutput;
1516
use SwooleTW\Http\Middleware\AccessLog;
1617
use SwooleTW\Http\Server\Facades\Server;
1718
use Illuminate\Contracts\Container\Container;
@@ -372,20 +373,20 @@ protected function isDaemon(): bool
372373
*/
373374
protected function checkEnvironment()
374375
{
375-
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
376-
$this->error("Swoole extension doesn't support Windows OS yet.");
376+
if (OS::is(OS::WIN)) {
377+
$this->error('Swoole extension doesn\'t support Windows OS.');
377378

378379
exit(1);
379380
}
380381

381382
if (! extension_loaded('swoole')) {
382-
$this->error("Can't detect Swoole extension installed.");
383+
$this->error('Can\'t detect Swoole extension installed.');
383384

384385
exit(1);
385386
}
386387

387-
if (! version_compare(swoole_version(), '4.0.0', 'ge')) {
388-
$this->error("Your Swoole version must be higher than 4.0 to use coroutine.");
388+
if (! version_compare(swoole_version(), '4.3.1', 'ge')) {
389+
$this->error('Your Swoole version must be higher than `4.3.1`.');
389390

390391
exit(1);
391392
}

src/Helpers/FW.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class FW
4747
*/
4848
public static function is(string ...$types): bool
4949
{
50-
return \in_array(static::current(), $types, true);
50+
return in_array(static::current(), $types, true);
5151
}
5252

5353
/**

src/LumenServiceProvider.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,10 @@ protected function registerManager()
3131
*/
3232
protected function bootWebsocketRoutes()
3333
{
34-
$app = $this->app;
35-
36-
// router only exists after lumen 5.5
37-
if (property_exists($app, 'router')) {
38-
$app->router->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($app) {
39-
require __DIR__ . '/../routes/lumen_routes.php';
40-
});
41-
} else {
42-
$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
34+
$this->app->router
35+
->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($router) {
4336
require __DIR__ . '/../routes/lumen_routes.php';
4437
});
45-
}
4638
}
4739

4840
/**

0 commit comments

Comments
 (0)