Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Coroutine/PDOStatement.php
#	src/HttpServiceProvider.php
#	src/Server/Manager.php
#	src/Server/Sandbox.php
#	src/Task/SwooleTaskQueue.php
#	tests/Server/ManagerTest.php
  • Loading branch information
fractalzombie committed Dec 19, 2018
2 parents 781773d + 5d8ee95 commit 2fecb4e
Show file tree
Hide file tree
Showing 107 changed files with 2,540 additions and 720 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.DS_Store
phpunit.xml
composer.lock
.scannerwork

# Folders
vendor
Expand Down
12 changes: 12 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
build:
environment:
php: 7.2

filter:
excluded_paths:
- "tests/*"
- "routes/*"
- "config/*"
- "stubs/*"
dependency_paths:
- "vendor/*"
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ sudo: false

matrix:
include:
- php: 7.2
env: FRAMEWORK_VERSION=laravel/framework:5.1.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/framework:5.2.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/framework:5.3.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/framework:5.4.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/framework:5.5.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.1.*
env: FRAMEWORK_VERSION=laravel/framework:5.6.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.2.*
env: FRAMEWORK_VERSION=laravel/framework:5.7.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.3.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.4.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.5.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.6.*
- php: 7.2
env: FRAMEWORK_VERSION=laravel/lumen-framework:5.7.*

before_install:
- printf "\n" | pecl install swoole
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This package provides a high performance HTTP server to speed up your Laravel/Lu

| PHP | Laravel | Lumen | Swoole |
|:-------:|:-------:|:-----:|:-------:|
| >=7.1 | ~5.1 | ~5.1 | >=4.0.0 |
| >=7.1 | ~5.3 | ~5.1 | >=4.0.0 |

## Features

Expand Down
124 changes: 68 additions & 56 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,60 +1,72 @@
{
"name": "swooletw/laravel-swoole",
"description": "High performance HTTP server based on Swoole. Speed up your Laravel and Lumen applications.",
"keywords": ["swoole", "laravel", "lumen", "performance", "http", "server"],
"license": "MIT",
"authors": [
{
"name": "Albert Chen",
"email": "albert@unisharp.com"
},
{
"name": "Huang Yi",
"email": "coodeer@163.com"
}
],
"require": {
"php": "^7.1",
"illuminate/console": "~5.1",
"illuminate/contracts": "~5.1",
"illuminate/http": "~5.1",
"illuminate/support": "~5.1",
"predis/predis": "^1.1"
},
"require-dev": {
"laravel/lumen-framework": "~5.1",
"phpunit/phpunit": "^6.1",
"phpunit/php-code-coverage": "^5.2",
"satooshi/php-coveralls": "^1.0",
"mockery/mockery": "~1.0",
"codedungeon/phpunit-result-printer": "^0.14.0",
"php-mock/php-mock": "^2.0"
},
"autoload": {
"files": [
"src/Server/helpers.php"
],
"psr-4": {
"SwooleTW\\Http\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"SwooleTW\\Http\\Tests\\": "tests",
"SwooleTW\\Http\\Tests\\Fixtures\\Laravel\\App\\": "tests/fixtures/laravel/app"
}
"name": "swooletw/laravel-swoole",
"description": "High performance HTTP server based on Swoole. Speed up your Laravel and Lumen applications.",
"keywords": [
"swoole",
"laravel",
"lumen",
"performance",
"http",
"server"
],
"license": "MIT",
"authors": [
{
"name": "Albert Chen",
"email": "albert@unisharp.com"
},
"extra": {
"laravel": {
"providers": [
"SwooleTW\\Http\\LaravelServiceProvider"
],
"aliases": {
"Server": "SwooleTW\\Http\\Server\\Facades\\Server",
"Table": "SwooleTW\\Http\\Server\\Facades\\Table",
"Room": "SwooleTW\\Http\\Websocket\\Facades\\Room",
"Websocket": "SwooleTW\\Http\\Websocket\\Facades\\Websocket"
}
}
{
"name": "Huang Yi",
"email": "coodeer@163.com"
}
],
"require": {
"php": "^7.2",
"illuminate/console": "~5.3",
"illuminate/contracts": "~5.3",
"illuminate/http": "~5.3",
"illuminate/support": "~5.3",
"predis/predis": "^1.1"
},
"require-dev": {
"laravel/lumen-framework": "~5.3",
"phpunit/phpunit": "^6.1",
"phpunit/php-code-coverage": "^5.2",
"satooshi/php-coveralls": "^1.0",
"mockery/mockery": "~1.0",
"codedungeon/phpunit-result-printer": "^0.14.0",
"php-mock/php-mock": "^2.0"
},
"autoload": {
"files": [
"src/Server/helpers.php"
],
"psr-4": {
"SwooleTW\\Http\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"SwooleTW\\Http\\Tests\\": "tests",
"SwooleTW\\Http\\Tests\\Fixtures\\Laravel\\App\\": "tests/fixtures/laravel/app"
}
},
"extra": {
"laravel": {
"providers": [
"SwooleTW\\Http\\LaravelServiceProvider"
],
"aliases": {
"Server": "SwooleTW\\Http\\Server\\Facades\\Server",
"Table": "SwooleTW\\Http\\Server\\Facades\\Table",
"Room": "SwooleTW\\Http\\Websocket\\Facades\\Room",
"Websocket": "SwooleTW\\Http\\Websocket\\Facades\\Websocket"
}
}
},
"scripts": {
"post-autoload-dump": [
"@php copy_versioned_files.php"
]
}
}
19 changes: 16 additions & 3 deletions config/swoole_http.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

use Swoole\Table;

return [
/*
|--------------------------------------------------------------------------
Expand All @@ -17,9 +15,11 @@
'public_path' => base_path('public'),
// Determine if to use swoole to respond request for static files
'handle_static_files' => env('SWOOLE_HANDLE_STATIC', true),
'log' => env('SWOOLE_HTTP_LOG', true),
// You must add --enable-openssl while compiling Swoole
// Put `SWOOLE_SOCK_TCP | SWOOLE_SSL` if you want to enable SSL
'socket_type' => SWOOLE_SOCK_TCP,
'process_type' => SWOOLE_PROCESS,
'options' => [
'pid_file' => env('SWOOLE_HTTP_PID_FILE', base_path('storage/logs/swoole_http.pid')),
'log_file' => env('SWOOLE_HTTP_LOG_FILE', base_path('storage/logs/swoole_http.log')),
Expand Down Expand Up @@ -53,6 +53,19 @@
'enabled' => env('SWOOLE_HTTP_WEBSOCKET', false),
],

/*
|--------------------------------------------------------------------------
| Hot reload configuration
|--------------------------------------------------------------------------
*/
'hot_reload' => [
'enabled' => env('SWOOLE_HOT_RELOAD_ENABLE', true),
'level' => env('SWOOLE_HOT_RELOAD_DEEP_LEVEL', 10),
'directory' => env('SWOOLE_HOT_RELOAD_DIRECTORY', base_path()),
'log' => env('SWOOLE_HOT_RELOAD_LOG', true),
'files' => ['*.php'],
],

/*
|--------------------------------------------------------------------------
| Console output will be transferred to response content if enabled.
Expand Down Expand Up @@ -120,5 +133,5 @@
// ['name' => 'column_name', 'type' => Table::TYPE_STRING, 'size' => 1024],
// ]
// ],
]
],
];
4 changes: 2 additions & 2 deletions config/swoole_websocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
'room_rows' => 4096,
'room_size' => 2048,
'client_rows' => 8192,
'client_size' => 2048
'client_size' => 2048,
],

'redis' => [
Expand All @@ -92,6 +92,6 @@
//
],
'prefix' => 'swoole:',
]
],
],
];
27 changes: 27 additions & 0 deletions copy_versioned_files.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

require __DIR__.'/vendor/autoload.php';

use SwooleTW\Http\Coroutine\Connectors\ConnectorFactory;
use SwooleTW\Http\Helpers\FW;
use SwooleTW\Http\Task\QueueFactory;

$version = FW::version();
$framework = ucfirst(FW::current());
$color = "\033[0;32m";
$noColor = "\033[0m";
$stubs = [];

/* Copy queue class */
$stub = QueueFactory::stub($version);
QueueFactory::copy($stub, true);
$stubs[] = $stub;

/* Copy connector class */
$stub = ConnectorFactory::stub($version);
ConnectorFactory::copy($stub, true);
$stubs[] = $stub;

foreach ($stubs as $stub) {
echo "{$color}{$framework}{$noColor}: {$color}{$version}{$noColor}. Successfully copied stub: {$color}{$stub}{$noColor}\n";
}
10 changes: 5 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
stopOnFailure="false"
verbose="true"
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer">
<testsuites>
<testsuite name="Laravel Swoole Http Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="Laravel Swoole Http Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<const name="IN_PHPUNIT" value="true"/>
</php>
Expand Down
1 change: 1 addition & 0 deletions routes/laravel_routes.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php


use Illuminate\Support\Facades\Route;

/*
Expand Down
4 changes: 2 additions & 2 deletions routes/lumen_routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*/

$app->get('socket.io', [
'as' => 'io.get', 'uses' => 'SocketIOController@upgrade'
'as' => 'io.get', 'uses' => 'SocketIOController@upgrade',
]);

$app->post('socket.io', [
'as' => 'io.post', 'uses' => 'SocketIOController@reject'
'as' => 'io.post', 'uses' => 'SocketIOController@reject',
]);
3 changes: 1 addition & 2 deletions routes/websocket.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php


use Illuminate\Http\Request;
use SwooleTW\Http\Websocket\Facades\Websocket;

Expand All @@ -23,5 +24,3 @@
Websocket::on('example', function ($websocket, $data) {
$websocket->emit('message', $data);
});

// Websocket::on('test', 'ExampleController@method');
Loading

0 comments on commit 2fecb4e

Please sign in to comment.