From 659594792ab74a9eaca7a5422f9f0abfa5645e7a Mon Sep 17 00:00:00 2001
From: huangzhhui
-
-
+ * [
+ * '127.0.0.1:88',
+ * '127.0.0.1:88'
+ * ]
+ *
+ *
+ * @var array
+ */
+ protected $uri = [];
}
\ No newline at end of file
diff --git a/config/beans/service.php b/config/beans/service.php
index 07210fa0..5d9b68de 100644
--- a/config/beans/service.php
+++ b/config/beans/service.php
@@ -11,7 +11,7 @@
'type' => 'json',
],
'consulProvider' => [
- 'class' => \Swoft\Service\ConsulProvider::class,
+ 'class' => \Swoft\Service\ConsulProviderInterface::class,
'address' => '127.0.0.1:80',
],
"userPool" => [
diff --git a/config/properties/app.php b/config/properties/app.php
index 839d345e..94e78b40 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -19,5 +19,8 @@
'user' => [
'timeout' => 3000
]
- ]
+ ],
+ 'database' => require dirname(__FILE__).DS."db.php",
+ 'cache' => require dirname(__FILE__).DS."cache.php",
+ 'service' => require dirname(__FILE__).DS."service.php",
];
\ No newline at end of file
diff --git a/config/properties/cache.php b/config/properties/cache.php
new file mode 100644
index 00000000..8a1aab42
--- /dev/null
+++ b/config/properties/cache.php
@@ -0,0 +1,15 @@
+ [
+ "uri" => [
+ '127.0.0.1:6379',
+ '127.0.0.1:6379',
+ ],
+ "maxIdel" => 6,
+ "maxActive" => 10,
+ "timeout" => 200,
+ "balancer" => 'random',
+ "useProvider" => false,
+ 'provider' => 'consul',
+ ],
+];
\ No newline at end of file
diff --git a/config/properties/db.php b/config/properties/db.php
new file mode 100644
index 00000000..05e0b10e
--- /dev/null
+++ b/config/properties/db.php
@@ -0,0 +1,4 @@
+
Date: Sat, 16 Dec 2017 21:06:22 +0800
Subject: [PATCH 007/643] =?UTF-8?q?properties=E9=85=8D=E7=BD=AE=E5=92=8Cen?=
=?UTF-8?q?v=E9=85=8D=E7=BD=AE=E5=B7=B2=E7=BB=8FRedis=E8=BF=9E=E6=8E=A5?=
=?UTF-8?q?=E6=B1=A0=E9=87=8D=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Pool/UserPoolConfig.php | 89 ++++++++++++++++++++++++++++++++++++
app/Pool/UserServicePool.php | 43 ++---------------
config/beans/base.php | 4 ++
config/properties/cache.php | 8 ++--
4 files changed, 103 insertions(+), 41 deletions(-)
create mode 100644 app/Pool/UserPoolConfig.php
diff --git a/app/Pool/UserPoolConfig.php b/app/Pool/UserPoolConfig.php
new file mode 100644
index 00000000..582681dd
--- /dev/null
+++ b/app/Pool/UserPoolConfig.php
@@ -0,0 +1,89 @@
+
+ * @copyright Copyright 2010-2016 swoft software
+ * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
+ */
+class UserPoolConfig
+{
+ /**
+ * the maximum number of idle connections
+ *
+ * @Value(name="${{prefix.name}.maxIdel}", env="${{prefix.env}_MAX_IDEL}")
+ * @var int
+ */
+ protected $maxIdel = 6;
+
+ /**
+ * the maximum number of active connections
+ *
+ * @Value(name="${{prefix.name}.maxActive}", env="${{prefix.env}_MAX_ACTIVE}")
+ * @var int
+ */
+ protected $maxActive = 50;
+
+ /**
+ * the maximum number of wait connections
+ *
+ * @Value(name="${{prefix.name}.maxWait}", env="${{prefix.env}_MAX_WAIT}")
+ * @var int
+ */
+ protected $maxWait = 100;
+
+ /**
+ * the time of connect timeout
+ *
+ * @Value(name="${{prefix.name}.timeout}", env="${{prefix.env}_TIMEOUT}")
+ * @var int
+ */
+ protected $timeout = 200;
+
+ /**
+ * the addresses of connection
+ *
+ *
+ * [
+ * '127.0.0.1:88',
+ * '127.0.0.1:88'
+ * ]
+ *
+ *
+ * @Value(name="${{prefix.name}.uri}", env="${{prefix.env}_URI}")
+ * @var array
+ */
+ protected $uri = [];
+
+ /**
+ * whether to user provider(consul/etcd/zookeeper)
+ *
+ * @Value(name="${{prefix.name}.useProvider}", env="${{prefix.env}_USE_PROVIDER}")
+ * @var bool
+ */
+ protected $useProvider = false;
+
+ /**
+ * the default balancer is random balancer
+ *
+ * @Value(name="${{prefix.name}.balancer}", env="${{prefix.env}_BALANCER}")
+ * @var string
+ */
+ protected $balancer = BalancerManager::TYPE_RANDOM;
+
+ /**
+ * the default provider is consul provider
+ *
+ * @Value(name="${{prefix.name}.provider}", env="${{prefix.env}_PROVIDER}")
+ * @var string
+ */
+ protected $serviceProvider = null;
+
+
+
+}
\ No newline at end of file
diff --git a/app/Pool/UserServicePool.php b/app/Pool/UserServicePool.php
index 2d7d705f..3065b4b3 100644
--- a/app/Pool/UserServicePool.php
+++ b/app/Pool/UserServicePool.php
@@ -2,6 +2,7 @@
namespace App\Pool;
+use Swoft\Bean\Annotation\Inject;
use Swoft\Bean\Annotation\Pool;
use Swoft\Pool\ServicePool;
@@ -9,6 +10,7 @@
* the pool of user service
*
* @Pool(name="user")
+ *
* @uses UserServicePool
* @version 2017年12月14日
* @author stelin
- * [
- * '127.0.0.1:88',
- * '127.0.0.1:88'
- * ]
- *
+ * @Inject()
*
- * @var array
+ * @var \App\Pool\UserPoolConfig
*/
- protected $uri = [];
+ private $poolConfig;
}
\ No newline at end of file
diff --git a/config/beans/base.php b/config/beans/base.php
index ecb11a7d..f0eaec8b 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -10,6 +10,10 @@
'errorAction' => '/error/index',
'useProvider' => false,
],
+ 'balancerSelector' => [
+ 'balancers' =>[
+ ]
+ ],
'httpRouter' => [
'class' => \Swoft\Router\Http\HandlerMapping::class,
'ignoreLastSep' => false,
diff --git a/config/properties/cache.php b/config/properties/cache.php
index 8a1aab42..97f63a4f 100644
--- a/config/properties/cache.php
+++ b/config/properties/cache.php
@@ -1,13 +1,15 @@
[
+ 'name' => 'redis',
"uri" => [
'127.0.0.1:6379',
'127.0.0.1:6379',
],
- "maxIdel" => 6,
- "maxActive" => 10,
- "timeout" => 200,
+ "maxIdel" => 8,
+ "maxActive" => 8,
+ "maxWait" => 8,
+ "timeout" => 8,
"balancer" => 'random',
"useProvider" => false,
'provider' => 'consul',
From 607633f4e0fc859da28420d3c90f9088b98d2f43 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sun, 17 Dec 2017 22:47:38 +0800
Subject: [PATCH 008/643] =?UTF-8?q?RPC=E6=9C=8D=E5=8A=A1=E7=86=94=E6=96=AD?=
=?UTF-8?q?=E5=99=A8=E5=92=8C=E8=BF=9E=E6=8E=A5=E6=B1=A0=E6=B3=A8=E8=A7=A3?=
=?UTF-8?q?=E5=AE=9E=E7=8E=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Breaker/UserBreaker.php | 4 +++
app/Pool/{ => Config}/UserPoolConfig.php | 39 +++++++++++++++---------
app/Pool/UserServicePool.php | 3 +-
config/properties/db.php | 28 +++++++++++++++++
4 files changed, 58 insertions(+), 16 deletions(-)
rename app/Pool/{ => Config}/UserPoolConfig.php (52%)
diff --git a/app/Breaker/UserBreaker.php b/app/Breaker/UserBreaker.php
index 58f55adb..a372b5d8 100644
--- a/app/Breaker/UserBreaker.php
+++ b/app/Breaker/UserBreaker.php
@@ -3,6 +3,7 @@
namespace App\Breaker;
use Swoft\Bean\Annotation\Breaker;
+use Swoft\Bean\Annotation\Value;
use Swoft\Circuit\CircuitBreaker;
/**
@@ -21,6 +22,7 @@ class UserBreaker extends CircuitBreaker
* The number of successive failures
* If the arrival, the state switch to open
*
+ * @Value(name="${config.breaker.user.failCount}", env="${USER_BREAKER_FAIL_COUNT}")
* @var int
*/
protected $swithToFailCount = 6;
@@ -29,6 +31,7 @@ class UserBreaker extends CircuitBreaker
* The number of successive successes
* If the arrival, the state switch to close
*
+ * @Value(name="${config.breaker.user.SuccessCount}", env="${USER_BREAKER_SUCCESS_COUNT}")
* @var int
*/
protected $swithToSuccessCount = 6;
@@ -37,6 +40,7 @@ class UserBreaker extends CircuitBreaker
* Switch close to open delay time
* The unit is milliseconds
*
+ * @Value(name="${config.breaker.user.delayTime}", env="${USER_BREAKER_DELAY_TIME}")
* @var int
*/
protected $delaySwithTimer = 5000;
diff --git a/app/Pool/UserPoolConfig.php b/app/Pool/Config/UserPoolConfig.php
similarity index 52%
rename from app/Pool/UserPoolConfig.php
rename to app/Pool/Config/UserPoolConfig.php
index 582681dd..e8ff02cd 100644
--- a/app/Pool/UserPoolConfig.php
+++ b/app/Pool/Config/UserPoolConfig.php
@@ -1,10 +1,14 @@
@@ -13,10 +17,18 @@
*/
class UserPoolConfig
{
+ /**
+ * the name of pool
+ *
+ * @Value(name="${config.service.user.name}", env="${SERVICE_USER_NAME}")
+ * @var string
+ */
+ protected $name = "";
+
/**
* the maximum number of idle connections
*
- * @Value(name="${{prefix.name}.maxIdel}", env="${{prefix.env}_MAX_IDEL}")
+ * @Value(name="${config.service.user.maxIdel}", env="${SERVICE_USER_MAX_IDEL}")
* @var int
*/
protected $maxIdel = 6;
@@ -24,7 +36,7 @@ class UserPoolConfig
/**
* the maximum number of active connections
*
- * @Value(name="${{prefix.name}.maxActive}", env="${{prefix.env}_MAX_ACTIVE}")
+ * @Value(name="${config.service.user.maxActive}", env="${SERVICE_USER_MAX_ACTIVE}")
* @var int
*/
protected $maxActive = 50;
@@ -32,7 +44,7 @@ class UserPoolConfig
/**
* the maximum number of wait connections
*
- * @Value(name="${{prefix.name}.maxWait}", env="${{prefix.env}_MAX_WAIT}")
+ * @Value(name="${config.service.user.maxWait}", env="${SERVICE_USER_MAX_WAIT}")
* @var int
*/
protected $maxWait = 100;
@@ -40,7 +52,7 @@ class UserPoolConfig
/**
* the time of connect timeout
*
- * @Value(name="${{prefix.name}.timeout}", env="${{prefix.env}_TIMEOUT}")
+ * @Value(name="${config.service.user.timeout}", env="${SERVICE_USER_TIMEOUT}")
* @var int
*/
protected $timeout = 200;
@@ -55,7 +67,7 @@ class UserPoolConfig
* ]
*
*
- * @Value(name="${{prefix.name}.uri}", env="${{prefix.env}_URI}")
+ * @Value(name="${config.service.user.uri}", env="${SERVICE_USER_URI}")
* @var array
*/
protected $uri = [];
@@ -63,7 +75,7 @@ class UserPoolConfig
/**
* whether to user provider(consul/etcd/zookeeper)
*
- * @Value(name="${{prefix.name}.useProvider}", env="${{prefix.env}_USE_PROVIDER}")
+ * @Value(name="${config.service.user.useProvider}", env="${SERVICE_USER_USE_PROVIDER}")
* @var bool
*/
protected $useProvider = false;
@@ -71,19 +83,16 @@ class UserPoolConfig
/**
* the default balancer is random balancer
*
- * @Value(name="${{prefix.name}.balancer}", env="${{prefix.env}_BALANCER}")
+ * @Value(name="${config.service.user.balancer}", env="${SERVICE_USER_BALANCER}")
* @var string
*/
- protected $balancer = BalancerManager::TYPE_RANDOM;
+ protected $balancer = BalancerSelector::TYPE_RANDOM;
/**
* the default provider is consul provider
*
- * @Value(name="${{prefix.name}.provider}", env="${{prefix.env}_PROVIDER}")
+ * @Value(name="${config.service.user.provider}", env="${SERVICE_USER_PROVIDER}")
* @var string
*/
- protected $serviceProvider = null;
-
-
-
+ protected $provider = ProviderSelector::TYPE_CONSUL;
}
\ No newline at end of file
diff --git a/app/Pool/UserServicePool.php b/app/Pool/UserServicePool.php
index 3065b4b3..0d10456a 100644
--- a/app/Pool/UserServicePool.php
+++ b/app/Pool/UserServicePool.php
@@ -5,6 +5,7 @@
use Swoft\Bean\Annotation\Inject;
use Swoft\Bean\Annotation\Pool;
use Swoft\Pool\ServicePool;
+use App\Pool\Config\UserPoolConfig;
/**
* the pool of user service
@@ -22,7 +23,7 @@ class UserServicePool extends ServicePool
/**
* @Inject()
*
- * @var \App\Pool\UserPoolConfig
+ * @var UserPoolConfig
*/
private $poolConfig;
}
\ No newline at end of file
diff --git a/config/properties/db.php b/config/properties/db.php
index 05e0b10e..94dfbb13 100644
--- a/config/properties/db.php
+++ b/config/properties/db.php
@@ -1,4 +1,32 @@
[
+ 'name' => 'redis',
+ "uri" => [
+ '127.0.0.1:6379',
+ '127.0.0.1:6379',
+ ],
+ "maxIdel" => 8,
+ "maxActive" => 8,
+ "maxWait" => 8,
+ "timeout" => 8,
+ "balancer" => 'random',
+ "useProvider" => false,
+ 'provider' => 'consul',
+ ],
+ 'slave' => [
+ 'name' => 'redis',
+ "uri" => [
+ '127.0.0.1:6379',
+ '127.0.0.1:6379',
+ ],
+ "maxIdel" => 8,
+ "maxActive" => 8,
+ "maxWait" => 8,
+ "timeout" => 8,
+ "balancer" => 'random',
+ "useProvider" => false,
+ 'provider' => 'consul',
+ ],
];
\ No newline at end of file
From 930006dd134f8b242d19670809636f47c6a19677 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Mon, 18 Dec 2017 23:39:52 +0800
Subject: [PATCH 009/643] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?=
=?UTF-8?q?=E6=B1=A0=E5=92=8CRPC=E8=BF=9E=E6=8E=A5=E6=B1=A0=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Breaker/UserBreaker.php | 6 +++---
app/Pool/Config/UserPoolConfig.php | 23 ++++++++++++----------
app/Pool/UserServicePool.php | 2 +-
config/beans/base.php | 31 ++++++++++++++++++++----------
config/beans/db.php | 31 ------------------------------
config/beans/redis.php | 17 ----------------
config/beans/service.php | 29 ++++------------------------
config/properties/app.php | 3 +++
config/properties/breaker.php | 8 ++++++++
config/properties/db.php | 4 ++--
10 files changed, 55 insertions(+), 99 deletions(-)
delete mode 100644 config/beans/db.php
delete mode 100644 config/beans/redis.php
create mode 100644 config/properties/breaker.php
diff --git a/app/Breaker/UserBreaker.php b/app/Breaker/UserBreaker.php
index a372b5d8..46f5935d 100644
--- a/app/Breaker/UserBreaker.php
+++ b/app/Breaker/UserBreaker.php
@@ -25,16 +25,16 @@ class UserBreaker extends CircuitBreaker
* @Value(name="${config.breaker.user.failCount}", env="${USER_BREAKER_FAIL_COUNT}")
* @var int
*/
- protected $swithToFailCount = 6;
+ protected $swithToFailCount = 3;
/**
* The number of successive successes
* If the arrival, the state switch to close
*
- * @Value(name="${config.breaker.user.SuccessCount}", env="${USER_BREAKER_SUCCESS_COUNT}")
+ * @Value(name="${config.breaker.user.successCount}", env="${USER_BREAKER_SUCCESS_COUNT}")
* @var int
*/
- protected $swithToSuccessCount = 6;
+ protected $swithToSuccessCount = 3;
/**
* Switch close to open delay time
diff --git a/app/Pool/Config/UserPoolConfig.php b/app/Pool/Config/UserPoolConfig.php
index e8ff02cd..8622f106 100644
--- a/app/Pool/Config/UserPoolConfig.php
+++ b/app/Pool/Config/UserPoolConfig.php
@@ -4,6 +4,9 @@
use Swoft\Bean\Annotation\Bean;
use Swoft\Bean\Annotation\Value;
+use Swoft\Pool\BalancerSelector;
+use Swoft\Pool\ProviderSelector;
+use Swoft\Testing\Pool\Config\PropertyPoolConfig;
/**
* the config of service user
@@ -15,12 +18,12 @@
* @copyright Copyright 2010-2016 swoft software
* @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
-class UserPoolConfig
+class UserPoolConfig extends PropertyPoolConfig
{
/**
* the name of pool
*
- * @Value(name="${config.service.user.name}", env="${SERVICE_USER_NAME}")
+ * @Value(name="${config.service.user.name}", env="${USER_POOL_NAME}")
* @var string
*/
protected $name = "";
@@ -28,7 +31,7 @@ class UserPoolConfig
/**
* the maximum number of idle connections
*
- * @Value(name="${config.service.user.maxIdel}", env="${SERVICE_USER_MAX_IDEL}")
+ * @Value(name="${config.service.user.maxIdel}", env="${USER_POOL_MAX_IDEL}")
* @var int
*/
protected $maxIdel = 6;
@@ -36,7 +39,7 @@ class UserPoolConfig
/**
* the maximum number of active connections
*
- * @Value(name="${config.service.user.maxActive}", env="${SERVICE_USER_MAX_ACTIVE}")
+ * @Value(name="${config.service.user.maxActive}", env="${USER_POOL_MAX_ACTIVE}")
* @var int
*/
protected $maxActive = 50;
@@ -44,7 +47,7 @@ class UserPoolConfig
/**
* the maximum number of wait connections
*
- * @Value(name="${config.service.user.maxWait}", env="${SERVICE_USER_MAX_WAIT}")
+ * @Value(name="${config.service.user.maxWait}", env="${USER_POOL_MAX_WAIT}")
* @var int
*/
protected $maxWait = 100;
@@ -52,7 +55,7 @@ class UserPoolConfig
/**
* the time of connect timeout
*
- * @Value(name="${config.service.user.timeout}", env="${SERVICE_USER_TIMEOUT}")
+ * @Value(name="${config.service.user.timeout}", env="${USER_POOL_TIMEOUT}")
* @var int
*/
protected $timeout = 200;
@@ -67,7 +70,7 @@ class UserPoolConfig
* ]
*
*
- * @Value(name="${config.service.user.uri}", env="${SERVICE_USER_URI}")
+ * @Value(name="${config.service.user.uri}", env="${USER_POOL_URI}")
* @var array
*/
protected $uri = [];
@@ -75,7 +78,7 @@ class UserPoolConfig
/**
* whether to user provider(consul/etcd/zookeeper)
*
- * @Value(name="${config.service.user.useProvider}", env="${SERVICE_USER_USE_PROVIDER}")
+ * @Value(name="${config.service.user.useProvider}", env="${USER_POOL_USE_PROVIDER}")
* @var bool
*/
protected $useProvider = false;
@@ -83,7 +86,7 @@ class UserPoolConfig
/**
* the default balancer is random balancer
*
- * @Value(name="${config.service.user.balancer}", env="${SERVICE_USER_BALANCER}")
+ * @Value(name="${config.service.user.balancer}", env="${USER_POOL_BALANCER}")
* @var string
*/
protected $balancer = BalancerSelector::TYPE_RANDOM;
@@ -91,7 +94,7 @@ class UserPoolConfig
/**
* the default provider is consul provider
*
- * @Value(name="${config.service.user.provider}", env="${SERVICE_USER_PROVIDER}")
+ * @Value(name="${config.service.user.provider}", env="${USER_POOL_PROVIDER}")
* @var string
*/
protected $provider = ProviderSelector::TYPE_CONSUL;
diff --git a/app/Pool/UserServicePool.php b/app/Pool/UserServicePool.php
index 0d10456a..f350ac64 100644
--- a/app/Pool/UserServicePool.php
+++ b/app/Pool/UserServicePool.php
@@ -25,5 +25,5 @@ class UserServicePool extends ServicePool
*
* @var UserPoolConfig
*/
- private $poolConfig;
+ protected $poolConfig;
}
\ No newline at end of file
diff --git a/config/beans/base.php b/config/beans/base.php
index f0eaec8b..024632f0 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -2,32 +2,43 @@
return [
'dispatcherServer' => [
- 'class' => \Swoft\Web\DispatcherServer::class
+ 'class' => \Swoft\Web\DispatcherServer::class,
],
- 'application' => [
+ 'application' => [
'id' => APP_NAME,
'name' => APP_NAME,
'errorAction' => '/error/index',
'useProvider' => false,
],
'balancerSelector' => [
- 'balancers' =>[
- ]
+ 'class' => \Swoft\Pool\BalancerSelector::class,
+ 'balancers' => [
+
+ ],
+ ],
+ 'providerSelector' => [
+ 'class' => \Swoft\Pool\ProviderSelector::class,
+ 'providers' => [
+
+ ],
],
- 'httpRouter' => [
+ 'httpRouter' => [
'class' => \Swoft\Router\Http\HandlerMapping::class,
'ignoreLastSep' => false,
'tmpCacheNumber' => 1000,
'matchAll' => '',
],
- 'requestParser' =>[
- 'class' => \Swoft\Web\RequestParser::class
+ 'requestParser' => [
+ 'class' => \Swoft\Web\RequestParser::class,
+ 'parsers' => [
+
+ ],
],
- 'renderer' => [
+ 'renderer' => [
'class' => \Swoft\Web\ViewRenderer::class,
'viewsPath' => '@resources/views/',
],
- 'eventManager' => [
- 'class' => \Swoft\Event\EventManager::class,
+ 'eventManager' => [
+ 'class' => \Swoft\Event\EventManager::class,
],
];
diff --git a/config/beans/db.php b/config/beans/db.php
deleted file mode 100644
index a605eca9..00000000
--- a/config/beans/db.php
+++ /dev/null
@@ -1,31 +0,0 @@
- [
- "class" => \Swoft\Pool\DbPool::class,
- "uri" => [
- '127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
- '127.0.0.1:3306/test?user=root&password=123456&charset=utf8'
- ],
- "maxIdel" => 6,
- "maxActive" => 10,
- "timeout" => 200,
- "balancer" => '${randomBalancer}',
- "serviceName" => 'user',
- "useProvider" => false,
- 'driver' => \Swoft\Pool\DbPool::MYSQL
- ],
- "dbSlave" => [
- "class" => \Swoft\Pool\DbPool::class,
- "uri" => [
- '127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
- '127.0.0.1:3306/test?user=root&password=123456&charset=utf8'
- ],
- "maxIdel" => 6,
- "maxActive" => 10,
- "timeout" => 200,
- "balancer" => '${randomBalancer}',
- "serviceName" => 'user',
- "useProvider" => false,
- 'driver' => \Swoft\Pool\DbPool::MYSQL
- ],
-];
\ No newline at end of file
diff --git a/config/beans/redis.php b/config/beans/redis.php
deleted file mode 100644
index e1e5e4b1..00000000
--- a/config/beans/redis.php
+++ /dev/null
@@ -1,17 +0,0 @@
- [
- 'class' => \Swoft\Pool\RedisPool::class,
- "uri" => [
- '127.0.0.1:6379',
- '127.0.0.1:6379'
- ],
- "maxIdel" => 6,
- "maxActive" => 10,
- "timeout" => '${config.Service.user.timeout}',
- "balancer" => '${randomBalancer}',
- "serviceName" => 'redis',
- "useProvider" => false,
- 'serviceprovider' => '${consulProvider}'
- ],
-];
\ No newline at end of file
diff --git a/config/beans/service.php b/config/beans/service.php
index 5d9b68de..54981a01 100644
--- a/config/beans/service.php
+++ b/config/beans/service.php
@@ -7,31 +7,10 @@
'class' => \Swoft\Router\Service\HandlerMapping::class,
],
'servicePacker' => [
- 'class' => \Swoft\Service\ServicePacker::class,
- 'type' => 'json',
- ],
- 'consulProvider' => [
- 'class' => \Swoft\Service\ConsulProviderInterface::class,
- 'address' => '127.0.0.1:80',
- ],
- "userPool" => [
- "class" => \Swoft\Pool\ServicePool::class,
- "uri" => [
- '127.0.0.1:8099',
- '127.0.0.1:8099',
+ 'class' => \Swoft\Service\ServicePacker::class,
+ 'type' => 'json',
+ 'packers' => [
+
],
- "maxIdel" => 6,
- "maxActive" => 10,
- "timeout" => '${config.Service.user.timeout}',
- "balancer" => '${randomBalancer}',
- "serviceName" => 'user',
- "useProvider" => false,
- 'serviceprovider' => '${consulProvider}',
- ],
- "userBreaker" => [
- 'class' => \Swoft\Circuit\CircuitBreaker::class,
- 'swithToSuccessCount' => 6, // 请求成功次数上限(状态切换)
- 'swithToFailCount' => 6, // 请求失败次数上限(状态切换)
- 'delaySwithTimer' => 5000, // 开启状态切换到半开状态的延迟时间,单位毫秒
],
];
\ No newline at end of file
diff --git a/config/properties/app.php b/config/properties/app.php
index 94e78b40..d7d73701 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -9,6 +9,8 @@
'App\Tasks',
'App\Services',
'App\Process',
+ 'App\Breaker',
+ 'App\Pool',
],
'I18n' => [
'sourceLanguage' => '@root/resources/messages/',
@@ -23,4 +25,5 @@
'database' => require dirname(__FILE__).DS."db.php",
'cache' => require dirname(__FILE__).DS."cache.php",
'service' => require dirname(__FILE__).DS."service.php",
+ 'breaker' => require dirname(__FILE__).DS."breaker.php",
];
\ No newline at end of file
diff --git a/config/properties/breaker.php b/config/properties/breaker.php
new file mode 100644
index 00000000..1081a258
--- /dev/null
+++ b/config/properties/breaker.php
@@ -0,0 +1,8 @@
+ [
+ 'failCount' => 3,
+ 'successCount' => 3,
+ 'delayTime' => 500,
+ ],
+];
\ No newline at end of file
diff --git a/config/properties/db.php b/config/properties/db.php
index 94dfbb13..871df9cc 100644
--- a/config/properties/db.php
+++ b/config/properties/db.php
@@ -1,7 +1,7 @@
[
- 'name' => 'redis',
+ 'name' => 'master',
"uri" => [
'127.0.0.1:6379',
'127.0.0.1:6379',
@@ -16,7 +16,7 @@
],
'slave' => [
- 'name' => 'redis',
+ 'name' => 'slave',
"uri" => [
'127.0.0.1:6379',
'127.0.0.1:6379',
From 0bbaa4a7ac6cffa1ec83c638205a5abb85785684 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Tue, 19 Dec 2017 17:24:55 +0800
Subject: [PATCH 010/643] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9E=B6=E6=9E=84?=
=?UTF-8?q?=E5=9B=BE=EF=BC=8C=E5=90=8E=E9=9D=A2=E9=87=8D=E6=96=B0=E7=BB=98?=
=?UTF-8?q?=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 8 --------
1 file changed, 8 deletions(-)
diff --git a/README.md b/README.md
index eab5241d..07d12ec7 100644
--- a/README.md
+++ b/README.md
@@ -36,14 +36,6 @@
- Inotify 自动 Reload
- 强大的日志系统
-# 系统架构
-
-
-
-
+ */
+ public function getUsers(array $ids);
+
+ /**
+ * @param string $id
+ *
+ * @return array
+ */
+ public function getUser(string $id);
+
+ public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = "desc");
+}
\ No newline at end of file
diff --git a/app/Lib/MdDemoInterface.php b/app/Lib/MdDemoInterface.php
new file mode 100644
index 00000000..59a6d69a
--- /dev/null
+++ b/app/Lib/MdDemoInterface.php
@@ -0,0 +1,13 @@
+
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
-class MiddlewareService
+class MiddlewareService implements MdDemoInterface
{
/**
- * @Mapping("pm")
- *
* @return array
*/
public function parentMiddleware()
@@ -35,8 +28,6 @@ public function parentMiddleware()
}
/**
- * @Mapping("fm")
- *
* @Middleware(class=ServiceMiddleware::class)
* @return array
*/
diff --git a/app/Services/UserService.php b/app/Services/UserService.php
deleted file mode 100644
index 7ad63264..00000000
--- a/app/Services/UserService.php
+++ /dev/null
@@ -1,75 +0,0 @@
-
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
- */
-class UserService
-{
- /**
- * 逻辑层
- *
- * @Inject()
- * @var UserLogic
- */
- private $userLogic;
-
- /**
- * 用户信息
- *
- * @Mapping("getUserInfo")
- * @param array ...$uids
- *
- * @return array
- */
- public function getUserInfo(...$uids)
- {
- return $this->userLogic->getUserInfo($uids);
- }
-
- /**
- * @Mapping("getUser")
- * @Enum(name="type", values={1,2,3})
- * @Number(name="uid", min=1, max=10)
- * @Strings(name="name", min=2, max=5)
- * @Floats(name="price", min=1.2, max=1.9)
- *
- * @param int $type
- * @param int $uid
- * @param string $name
- * @param float $price
- * @param string $desc default value
- * @return array
- */
- public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = "desc")
- {
- return [$type, $uid, $name, $price, $desc];
- }
-
- /**
- * 未使用注解,默认方法名
- *
- * @return array
- */
- public function getUserList()
- {
- return ['uid1', 'uid2'];
- }
-}
\ No newline at end of file
From 84d6a543f349b8509471d8caf40caa0649fbb1b7 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 9 Feb 2018 23:41:03 +0800
Subject: [PATCH 092/643] composer
---
composer.json | 39 ++-------------------------------------
1 file changed, 2 insertions(+), 37 deletions(-)
diff --git a/composer.json b/composer.json
index ab4e3334..97d00482 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,8 @@
"swoft/redis": "dev-master",
"swoft/console": "dev-master",
"swoft/devtool": "dev-master",
- "swoft/session": "dev-master"
+ "swoft/session": "dev-master",
+ "swoft/i18n": "dev-master"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
@@ -50,42 +51,6 @@
"test": "./vendor/bin/phpunit -c phpunit.xml"
},
"repositories": [
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-session"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-rpc"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-rpc-server"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-http-server"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-console"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-cache"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-redis"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-view"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-framework"
- },
{
"type": "composer",
"url": "https://packagist.phpcomposer.com/"
From 25646da6e3182577d08d3b32e332ab129a28994f Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 9 Feb 2018 23:48:19 +0800
Subject: [PATCH 093/643] rm i18n
---
composer.json | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/composer.json b/composer.json
index 97d00482..e35263c6 100644
--- a/composer.json
+++ b/composer.json
@@ -24,8 +24,7 @@
"swoft/redis": "dev-master",
"swoft/console": "dev-master",
"swoft/devtool": "dev-master",
- "swoft/session": "dev-master",
- "swoft/i18n": "dev-master"
+ "swoft/session": "dev-master"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
From 59210754a4c30a0e98683bcc6c124da823e88a13 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sat, 10 Feb 2018 14:29:35 +0800
Subject: [PATCH 094/643] i18n and service
---
app/Controllers/DemoController.php | 8 ++++----
app/Controllers/RpcController.php | 18 ++++++++++++++---
app/Models/Logic/UserLogic.php | 20 +++++++++++++++++++
composer.json | 3 ++-
.../{messages => languages}/en/default.php | 0
resources/{messages => languages}/en/msg.php | 0
.../{messages => languages}/zh/default.php | 0
resources/{messages => languages}/zh/msg.php | 0
8 files changed, 41 insertions(+), 8 deletions(-)
rename resources/{messages => languages}/en/default.php (100%)
rename resources/{messages => languages}/en/msg.php (100%)
rename resources/{messages => languages}/zh/default.php (100%)
rename resources/{messages => languages}/zh/msg.php (100%)
diff --git a/app/Controllers/DemoController.php b/app/Controllers/DemoController.php
index b65bd708..3a9eaa21 100644
--- a/app/Controllers/DemoController.php
+++ b/app/Controllers/DemoController.php
@@ -139,10 +139,10 @@ public function cor()
*/
public function i18n()
{
- $data[] = App::t("title", [], 'zh');
- $data[] = App::t("title", [], 'en');
- $data[] = App::t("msg.body", ["stelin", 999], 'en');
- $data[] = App::t("msg.body", ["stelin", 666], 'en');
+ $data[] = translate("title", [], 'zh');
+ $data[] = translate("title", [], 'en');
+ $data[] = translate("msg.body", ["stelin", 999], 'en');
+ $data[] = translate("msg.body", ["stelin", 666], 'en');
return $data;
}
diff --git a/app/Controllers/RpcController.php b/app/Controllers/RpcController.php
index 32341784..50602346 100644
--- a/app/Controllers/RpcController.php
+++ b/app/Controllers/RpcController.php
@@ -2,11 +2,11 @@
namespace App\Controllers;
+use App\Lib\DemoInterface;
+use Swoft\Bean\Annotation\Inject;
use Swoft\Http\Server\Bean\Annotation\Controller;
use Swoft\Http\Server\Bean\Annotation\RequestMapping;
use Swoft\Rpc\Client\Bean\Annotation\Reference;
-use Swoft\Rpc\Client\Service\Service;
-use App\Lib\DemoInterface;
/**
* rpc controller test
@@ -30,13 +30,18 @@ class RpcController
*/
private $demoServiceV2;
-
/**
* @Reference("user")
* @var \App\Lib\MdDemoInterface
*/
private $mdDemoService;
+ /**
+ * @Inject()
+ * @var \App\Models\Logic\UserLogic
+ */
+ private $logic;
+
/**
* @RequestMapping(route="call")
* @return array
@@ -52,6 +57,13 @@ public function call()
];
}
+ public function beanCall()
+ {
+ return [
+ $this->logic->rpcCall()
+ ];
+ }
+
/**
* @RequestMapping("validate")
*/
diff --git a/app/Models/Logic/UserLogic.php b/app/Models/Logic/UserLogic.php
index b326a7a3..f372c2d9 100644
--- a/app/Models/Logic/UserLogic.php
+++ b/app/Models/Logic/UserLogic.php
@@ -3,6 +3,7 @@
namespace App\Models\Logic;
use Swoft\Bean\Annotation\Bean;
+use Swoft\Rpc\Client\Bean\Annotation\Reference;
/**
* 用户逻辑层
@@ -17,6 +18,25 @@
*/
class UserLogic
{
+ /**
+ * @Reference("user")
+ *
+ * @var \App\Lib\DemoInterface
+ */
+ private $demoService;
+
+ /**
+ * @Reference(name="user", version="1.0.1")
+ *
+ * @var \App\Lib\DemoInterface
+ */
+ private $demoServiceV2;
+
+ public function rpcCall()
+ {
+ return ['bean', $this->demoService->getUser('12'), $this->demoServiceV2->getUser('16')];
+ }
+
public function getUserInfo(array $uids)
{
$user = [
diff --git a/composer.json b/composer.json
index e35263c6..97d00482 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,8 @@
"swoft/redis": "dev-master",
"swoft/console": "dev-master",
"swoft/devtool": "dev-master",
- "swoft/session": "dev-master"
+ "swoft/session": "dev-master",
+ "swoft/i18n": "dev-master"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
diff --git a/resources/messages/en/default.php b/resources/languages/en/default.php
similarity index 100%
rename from resources/messages/en/default.php
rename to resources/languages/en/default.php
diff --git a/resources/messages/en/msg.php b/resources/languages/en/msg.php
similarity index 100%
rename from resources/messages/en/msg.php
rename to resources/languages/en/msg.php
diff --git a/resources/messages/zh/default.php b/resources/languages/zh/default.php
similarity index 100%
rename from resources/messages/zh/default.php
rename to resources/languages/zh/default.php
diff --git a/resources/messages/zh/msg.php b/resources/languages/zh/msg.php
similarity index 100%
rename from resources/messages/zh/msg.php
rename to resources/languages/zh/msg.php
From c62030fb25cfce735dd7bcae779c5d5c7f374c46 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Mon, 12 Feb 2018 23:33:54 +0800
Subject: [PATCH 095/643] refactor task and add process
---
app/Boot/MyProcess.php | 32 ++++++
app/Commands/TestCommand.php | 12 ++-
app/Controllers/DemoController.php | 8 +-
app/Controllers/TaskController.php | 84 ++++++++++++++-
app/Listener/TaskFinish.php | 24 +++++
app/Process/MyProcess.php | 36 ++-----
app/Tasks/SyncTask.php | 160 ++++++++++++++++++++++++++++
app/Tasks/TestTask.php | 162 -----------------------------
composer.json | 7 +-
config/properties/app.php | 6 +-
10 files changed, 332 insertions(+), 199 deletions(-)
create mode 100644 app/Boot/MyProcess.php
create mode 100644 app/Listener/TaskFinish.php
create mode 100644 app/Tasks/SyncTask.php
delete mode 100644 app/Tasks/TestTask.php
diff --git a/app/Boot/MyProcess.php b/app/Boot/MyProcess.php
new file mode 100644
index 00000000..8711a806
--- /dev/null
+++ b/app/Boot/MyProcess.php
@@ -0,0 +1,32 @@
+getPname();
+ $processName = "$pname myProcess process";
+ $process->name($processName);
+
+ echo "Custom boot process \n";
+
+ $result = Task::deliverByProcess('sync', 'deliverCo', ['p', 'p2']);
+ var_dump($result);
+
+ ProcessBuilder::create('customProcess')->start();
+ }
+}
\ No newline at end of file
diff --git a/app/Commands/TestCommand.php b/app/Commands/TestCommand.php
index edfeb787..6bdd70a5 100644
--- a/app/Commands/TestCommand.php
+++ b/app/Commands/TestCommand.php
@@ -8,12 +8,13 @@
use Swoft\Console\Bean\Annotation\Mapping;
use Swoft\Console\Input\Input;
use Swoft\Console\Output\Output;
+use Swoft\Core\Coroutine;
use Swoft\Log\Log;
/**
* the group of test command
*
- * @Command()
+ * @Command(coroutine=true)
* @uses TestCommand
* @version 2017年11月03日
* @author stelin
@@ -44,7 +45,14 @@ class TestCommand
*/
public function test(Input $input, Output $output)
{
- var_dump('test', $input, $output);
+ App::error('this is eror');
+ App::trace('this is trace');
+ Coroutine::create(function (){
+ App::error('this is eror child');
+ App::trace('this is trace child');
+ });
+
+ var_dump('test', $input, $output, Coroutine::id(),Coroutine::tid());
}
/**
diff --git a/app/Controllers/DemoController.php b/app/Controllers/DemoController.php
index 3a9eaa21..91715478 100644
--- a/app/Controllers/DemoController.php
+++ b/app/Controllers/DemoController.php
@@ -96,10 +96,10 @@ public function index2()
*/
public function task()
{
- $result = Task::deliver('test', 'corTask', ['params1', 'params2'], Task::TYPE_COR);
- $mysql = Task::deliver('test', 'testMysql', [], Task::TYPE_COR);
- $http = Task::deliver('test', 'testHttp', [], Task::TYPE_COR, 20);
- $rpc = Task::deliver('test', 'testRpc', [], Task::TYPE_COR, 5);
+ $result = Task::deliver('test', 'corTask', ['params1', 'params2'], Task::TYPE_CO);
+ $mysql = Task::deliver('test', 'testMysql', [], Task::TYPE_CO);
+ $http = Task::deliver('test', 'testHttp', [], Task::TYPE_CO, 20);
+ $rpc = Task::deliver('test', 'testRpc', [], Task::TYPE_CO, 5);
$result1 = Task::deliver('test', 'asyncTask', [], Task::TYPE_ASYNC);
return [$rpc, $http, $mysql, $result, $result1];
diff --git a/app/Controllers/TaskController.php b/app/Controllers/TaskController.php
index 5310d522..ba69ef06 100644
--- a/app/Controllers/TaskController.php
+++ b/app/Controllers/TaskController.php
@@ -10,9 +10,87 @@
*/
class TaskController
{
- public function cor()
+ /**
+ * Deliver co task
+ *
+ * @return array
+ */
+ public function co()
{
- $result = Task::deliver('test', 'corTask', ['params1', 'params2'], Task::TYPE_COR);
- return [$result, 1];
+ $result = Task::deliver('sync', 'deliverCo', ['p', 'p2'], Task::TYPE_CO);
+
+ return [$result];
+ }
+
+ /**
+ * Deliver async task
+ *
+ * @return array
+ */
+ public function async()
+ {
+ $result = Task::deliver('sync', 'deliverAsync', ['p', 'p2'], Task::TYPE_ASYNC);
+
+ return [$result];
+ }
+
+ /**
+ * Cache task
+ *
+ * @return array
+ */
+ public function cache()
+ {
+ $result = Task::deliver('sync', 'cache', [], Task::TYPE_CO);
+
+ return [$result];
+ }
+
+ /**
+ * Mysql task
+ *
+ * @return array
+ */
+ public function mysql()
+ {
+ $result = Task::deliver('sync', 'mysql', [], Task::TYPE_CO);
+
+ return [$result];
+ }
+
+ /**
+ * Http task
+ *
+ * @return array
+ */
+ public function http()
+ {
+ $result = Task::deliver('sync', 'http', [], Task::TYPE_CO);
+
+ return [$result];
+ }
+
+ /**
+ * Rpc task
+ *
+ * @return array
+ */
+ public function rpc()
+ {
+ $result = Task::deliver('sync', 'rpc', [], Task::TYPE_CO);
+
+ return [$result];
+ }
+
+ /**
+ * Rpc task
+ *
+ * @return array
+ */
+ public function rpc2()
+ {
+ $result = Task::deliver('sync', 'rpc2', [], Task::TYPE_CO);
+
+ return [$result];
}
}
\ No newline at end of file
diff --git a/app/Listener/TaskFinish.php b/app/Listener/TaskFinish.php
new file mode 100644
index 00000000..dc57e6ad
--- /dev/null
+++ b/app/Listener/TaskFinish.php
@@ -0,0 +1,24 @@
+getParams());
+ }
+}
\ No newline at end of file
diff --git a/app/Process/MyProcess.php b/app/Process/MyProcess.php
index e6a7c537..be15acec 100644
--- a/app/Process/MyProcess.php
+++ b/app/Process/MyProcess.php
@@ -3,39 +3,25 @@
namespace App\Process;
use Swoft\App;
-use Swoole\Process;
-use Swoft\Bootstrap\Process\AbstractProcessInterface;
+use Swoft\Core\Coroutine;
+use Swoft\Process\Bean\Annotation\Process;
+use Swoft\Process\Process as SwoftProcess;
+use Swoft\Process\ProcessInterface;
/**
- * 自定义进程demo
+ * Custom process
*
- * @uses MyProcess
- * @version 2017年10月02日
- * @author stelin
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
+ * @Process(name="customProcess", coroutine=true)
*/
-class MyProcess extends AbstractProcessInterface
+class MyProcess implements ProcessInterface
{
- /**
- * 实际进程运行逻辑
- *
- * @param Process $process 进程对象
- */
- public function run(Process $process)
+ public function run(SwoftProcess $process)
{
- $pname = $this->server->getPname();
+ $pname = App::$server->getPname();
$processName = "$pname myProcess process";
$process->name($processName);
- $i = 1;
- while (true) {
-
- $this->task('test', 'testRpc', [], 5);
- echo "this my process \n";
- App::trace("my process count=" . $i);
- sleep(10);
- $i++;
- }
+ echo "Custom child process \n";
+ var_dump(Coroutine::id());
}
}
\ No newline at end of file
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
new file mode 100644
index 00000000..39859e39
--- /dev/null
+++ b/app/Tasks/SyncTask.php
@@ -0,0 +1,160 @@
+set('cacheKey', 'cache');
+
+ return cache('cacheKey');
+ }
+
+ /**
+ * Mysql task
+ *
+ * @return array
+ */
+ public function mysql(){
+ $result = User::findById(425)->getResult();
+
+ $query = User::findById(426);
+
+ /* @var User $user */
+ $user = $query->getResult(User::class);
+ return [$result, $user->getName()];
+ }
+
+ /**
+ * Http task
+ *
+ * @return mixed
+ */
+ public function http()
+ {
+ $client = new Client([
+ 'base_uri' => 'http://127.0.0.1/index/post?a=b',
+ 'timeout' => 2,
+ ]);
+
+ $result = $client->post('http://127.0.0.1/index/post?a=b')->getResponse();
+ $result2 = $client->get('http://www.baidu.com/');
+ $data['result'] = $result;
+ $data['result2'] = $result2;
+ return $data;
+ }
+
+ /**
+ * Rpc task
+ *
+ * @return mixed
+ */
+ public function rpc()
+ {
+ return $this->demoService->getUser('6666');
+ }
+
+ /**
+ * Rpc task
+ *
+ * @return mixed
+ */
+ public function rpc2()
+ {
+ return $this->logic->rpcCall();
+ }
+
+ /**
+ * crontab定时任务
+ * 每一秒执行一次
+ *
+ * @Scheduled(cron="* * * * * *")
+ */
+ public function cronTask()
+ {
+ echo time() . "每一秒执行一次 \n";
+ return 'cron';
+ }
+
+ /**
+ * 每分钟第3-5秒执行
+ *
+ * @Scheduled(cron="3-5 * * * * *")
+ */
+ public function cronooTask()
+ {
+ echo time() . "第3-5秒执行\n";
+ return 'cron';
+ }
+}
diff --git a/app/Tasks/TestTask.php b/app/Tasks/TestTask.php
deleted file mode 100644
index 00dbd1dc..00000000
--- a/app/Tasks/TestTask.php
+++ /dev/null
@@ -1,162 +0,0 @@
-
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
- */
-class TestTask
-{
- /**
- * 逻辑层
- *
- * @Inject()
- * @var IndexLogic
- */
- private $logic;
-
- /**
- * 任务中,使用redis自动切换成同步阻塞redis
- *
- * @param mixed $p1
- * @param mixed $p2
- *
- * @return string
- */
- public function corTask($p1, $p2)
- {
- static $status = 1;
- $status++;
- echo "this cor task \n";
- App::trace("this is task log");
- $name = cache()->get('name');
- return 'cor' . " $p1" . " $p2 " . $status . " " . $name;
- }
-
- /**
- * 任务中使用mysql自动切换为同步mysql
- *
- * @return bool|\Swoft\Db\DataResult
- */
- public function testMysql()
- {
- $user = new User();
- $user->setName("stelin");
- $user->setSex(1);
- $user->setDesc("this my desc");
- $user->setAge(mt_rand(1, 100));
-
- $count = new Count();
- $count->setFans(mt_rand(1, 1000));
- $count->setFollows(mt_rand(1, 1000));
-
- $em = EntityManager::create();
- $em->beginTransaction();
- $uid = $em->save($user);
- $count->setUid(intval($uid));
-
- $result = $em->save($count);
- if ($result === false) {
- $em->rollback();
- } else {
- $em->commit();
- }
- $em->close();
- return $result;
- }
-
- /**
- * 任务中使用HTTP,自动切换成同步curl
- *
- * @return mixed
- */
- public function testHttp()
- {
- $requestData = [
- 'name' => 'boy',
- 'desc' => 'php'
- ];
-
- $client = new Client([
- 'base_uri' => 'http://127.0.0.1/index/post?a=b',
- 'timeout' => 2,
- ]);
-
- $result = $client->post('http://127.0.0.1/index/post?a=b')->getResponse();
- $result2 = $client->get('http://www.baidu.com/');
- $data['result'] = $result;
- $data['result2'] = $result2;
- return $data;
- }
-
- /**
- * 任务中使用rpc,自动切换成同步TCP
- *
- * @return mixed
- */
- public function testRpc()
- {
- var_dump('^^^^^^^^^^^', ApplicationContext::getContext());
- App::trace("this rpc task worker");
- $result = Service::call("user", 'User::getUserInfo', [2, 6, 8]);
- return $result;
- }
-
-
- /**
- * 异步task
- *
- * @return string
- */
- public function asyncTask()
- {
- static $status = 1;
- $status++;
- echo "this async task \n";
- $name = cache()->get('name');
- App::trace("this is task log");
- return 'async-' . $status . '-' . $name;
- }
-
- /**
- * crontab定时任务
- * 每一秒执行一次
- *
- * @Scheduled(cron="* * * * * *")
- */
- public function cronTask()
- {
- echo time() . "每一秒执行一次 \n";
- return 'cron';
- }
-
- /**
- * 每分钟第3-5秒执行
- *
- * @Scheduled(cron="3-5 * * * * *")
- */
- public function cronooTask()
- {
- echo time() . "第3-5秒执行\n";
- return 'cron';
- }
-}
diff --git a/composer.json b/composer.json
index 97d00482..fe691401 100644
--- a/composer.json
+++ b/composer.json
@@ -25,7 +25,8 @@
"swoft/console": "dev-master",
"swoft/devtool": "dev-master",
"swoft/session": "dev-master",
- "swoft/i18n": "dev-master"
+ "swoft/i18n": "dev-master",
+ "swoft/process": "dev-master"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
@@ -51,6 +52,10 @@
"test": "./vendor/bin/phpunit -c phpunit.xml"
},
"repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-process"
+ },
{
"type": "composer",
"url": "https://packagist.phpcomposer.com/"
diff --git a/config/properties/app.php b/config/properties/app.php
index 8a21d061..43ba53e3 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -3,7 +3,8 @@
'version' => '1.0',
'autoInitBean' => true,
'bootScan' => [
- 'App\Commands'
+ 'App\Commands',
+ 'App\Boot',
],
'beanScan' => [
'App\Controllers',
@@ -11,10 +12,11 @@
'App\Middlewares',
'App\Tasks',
'App\Services',
- 'App\Process',
'App\Breaker',
'App\Pool',
'App\Exception',
+ 'App\Listener',
+ 'App\Process',
],
'I18n' => [
'sourceLanguage' => '@root/resources/messages/',
From 9daa3337f60897f5dfb2e713bb42d444e7733d34 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Tue, 13 Feb 2018 15:21:19 +0800
Subject: [PATCH 096/643] add process
---
app/Boot/MyProcess.php | 5 +++++
app/Process/MyProcess.php | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/app/Boot/MyProcess.php b/app/Boot/MyProcess.php
index 8711a806..193c72c0 100644
--- a/app/Boot/MyProcess.php
+++ b/app/Boot/MyProcess.php
@@ -29,4 +29,9 @@ public function run(SwoftProcess $process)
ProcessBuilder::create('customProcess')->start();
}
+
+ public function check(): bool
+ {
+ return true;
+ }
}
\ No newline at end of file
diff --git a/app/Process/MyProcess.php b/app/Process/MyProcess.php
index be15acec..4ac41553 100644
--- a/app/Process/MyProcess.php
+++ b/app/Process/MyProcess.php
@@ -24,4 +24,9 @@ public function run(SwoftProcess $process)
echo "Custom child process \n";
var_dump(Coroutine::id());
}
+
+ public function check(): bool
+ {
+ return true;
+ }
}
\ No newline at end of file
From 3ef881fb8fe190fe85d677a3552ecb7aab3d9c68 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Tue, 20 Feb 2018 21:13:32 +0800
Subject: [PATCH 097/643] add provider.php
---
.env.example | 12 ++++++++
app/Controllers/IndexController.php | 2 +-
app/Middlewares/ActionTestMiddleware.php | 2 +-
app/Middlewares/ControlerSubMiddleware.php | 2 +-
app/Middlewares/ControlerTestMiddleware.php | 2 +-
app/Middlewares/GroupTestMiddleware.php | 2 +-
app/Middlewares/ServiceMiddleware.php | 2 +-
app/Middlewares/ServiceSubMiddleware.php | 2 +-
app/Middlewares/SubMiddleware.php | 2 +-
app/Middlewares/SubMiddlewares.php | 2 +-
config/properties/provider.php | 31 +++++++++++++++++++++
11 files changed, 52 insertions(+), 9 deletions(-)
create mode 100644 config/properties/provider.php
diff --git a/.env.example b/.env.example
index ce6daf48..0859907d 100644
--- a/.env.example
+++ b/.env.example
@@ -81,3 +81,15 @@ USER_POOL_PROVIDER=consul
USER_BREAKER_FAIL_COUNT = 3
USER_BREAKER_SUCCESS_COUNT = 6
USER_BREAKER_DELAY_TIME = 5000
+
+# the provider of consul
+CONSUL_ADDRESS=http://127.0.0.1
+CONSUL_PORT=8500
+CONSUL_REGISTER_ETO=false
+CONSUL_REGISTER_SERVICE_ADDRESS=http://127.0.0.1
+CONSUL_REGISTER_SERVICE_PORT=88
+CONSUL_REGISTER_CHECK_NAME=user
+CONSUL_REGISTER_CHECK_TCP=127.0.0.1:8099
+CONSUL_REGISTER_CHECK_INTERVAL=10
+CONSUL_REGISTER_CHECK_TIMEOUT=1
+CONSUL_DISCOVERY_NAME=user
\ No newline at end of file
diff --git a/app/Controllers/IndexController.php b/app/Controllers/IndexController.php
index 9063d335..f3e404d0 100644
--- a/app/Controllers/IndexController.php
+++ b/app/Controllers/IndexController.php
@@ -17,7 +17,7 @@ class IndexController
{
/**
- * @RequestMapping()
+ * @RequestMapping("/")
* @View(template="index/index")
* @return array
*/
diff --git a/app/Middlewares/ActionTestMiddleware.php b/app/Middlewares/ActionTestMiddleware.php
index 5275daba..385cb310 100644
--- a/app/Middlewares/ActionTestMiddleware.php
+++ b/app/Middlewares/ActionTestMiddleware.php
@@ -6,7 +6,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Swoft\Bean\Annotation\Bean;
-use Swoft\Middleware\MiddlewareInterface;
+use Swoft\Http\Message\Middleware\MiddlewareInterface;
/**
diff --git a/app/Middlewares/ControlerSubMiddleware.php b/app/Middlewares/ControlerSubMiddleware.php
index 0943a322..e2f52a5c 100644
--- a/app/Middlewares/ControlerSubMiddleware.php
+++ b/app/Middlewares/ControlerSubMiddleware.php
@@ -6,7 +6,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Swoft\Bean\Annotation\Bean;
-use Swoft\Middleware\MiddlewareInterface;
+use Swoft\Http\Message\Middleware\MiddlewareInterface;
/**
* the sub middleware of controler
diff --git a/app/Middlewares/ControlerTestMiddleware.php b/app/Middlewares/ControlerTestMiddleware.php
index 36ebbbce..9ed158d2 100644
--- a/app/Middlewares/ControlerTestMiddleware.php
+++ b/app/Middlewares/ControlerTestMiddleware.php
@@ -6,7 +6,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Swoft\Bean\Annotation\Bean;
-use Swoft\Middleware\MiddlewareInterface;
+use Swoft\Http\Message\Middleware\MiddlewareInterface;
/**
* controler middleware test
diff --git a/app/Middlewares/GroupTestMiddleware.php b/app/Middlewares/GroupTestMiddleware.php
index efdbe9c6..21cff7f9 100644
--- a/app/Middlewares/GroupTestMiddleware.php
+++ b/app/Middlewares/GroupTestMiddleware.php
@@ -6,7 +6,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Swoft\Bean\Annotation\Bean;
-use Swoft\Middleware\MiddlewareInterface;
+use Swoft\Http\Message\Middleware\MiddlewareInterface;
/**
diff --git a/app/Middlewares/ServiceMiddleware.php b/app/Middlewares/ServiceMiddleware.php
index 4e1e9e30..ef748393 100644
--- a/app/Middlewares/ServiceMiddleware.php
+++ b/app/Middlewares/ServiceMiddleware.php
@@ -6,7 +6,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Swoft\Bean\Annotation\Bean;
-use Swoft\Middleware\MiddlewareInterface;
+use Swoft\Http\Message\Middleware\MiddlewareInterface;
/**
* the middleware of service
diff --git a/app/Middlewares/ServiceSubMiddleware.php b/app/Middlewares/ServiceSubMiddleware.php
index 0e003c0f..12c8c347 100644
--- a/app/Middlewares/ServiceSubMiddleware.php
+++ b/app/Middlewares/ServiceSubMiddleware.php
@@ -6,7 +6,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Swoft\Bean\Annotation\Bean;
-use Swoft\Middleware\MiddlewareInterface;
+use Swoft\Http\Message\Middleware\MiddlewareInterface;
/**
* the sub service of middleware
diff --git a/app/Middlewares/SubMiddleware.php b/app/Middlewares/SubMiddleware.php
index cd6e13f1..d940feb4 100644
--- a/app/Middlewares/SubMiddleware.php
+++ b/app/Middlewares/SubMiddleware.php
@@ -6,7 +6,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Swoft\Bean\Annotation\Bean;
-use Swoft\Middleware\MiddlewareInterface;
+use Swoft\Http\Message\Middleware\MiddlewareInterface;
/**
diff --git a/app/Middlewares/SubMiddlewares.php b/app/Middlewares/SubMiddlewares.php
index f689decb..ecd9b42e 100644
--- a/app/Middlewares/SubMiddlewares.php
+++ b/app/Middlewares/SubMiddlewares.php
@@ -7,7 +7,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Swoft\Core\RequestHandler;
use Swoft\Bean\Annotation\Bean;
-use Swoft\Middleware\MiddlewareInterface;
+use Swoft\Http\Message\Middleware\MiddlewareInterface;
/**
diff --git a/config/properties/provider.php b/config/properties/provider.php
new file mode 100644
index 00000000..0d6e59e8
--- /dev/null
+++ b/config/properties/provider.php
@@ -0,0 +1,31 @@
+ [
+ 'address' => '',
+ 'port' => 8500,
+ 'register' => [
+ 'id' => '',
+ 'name' => '',
+ 'tags' => [],
+ 'enableTagOverride' => false,
+ 'service' => [
+ 'address' => 'http://127.0.0.1/',
+ 'port' => '88',
+ ],
+ 'check' => [
+ 'id' => '',
+ 'name' => '',
+ 'tcp' => 'localhost:22',
+ 'interval' => 10,
+ 'timeout' => 1,
+ ],
+ ],
+ 'discovery' => [
+ 'name' => 'user',
+ 'dc' => 'dc',
+ 'near' => '',
+ 'tag' =>'',
+ 'passing' => true
+ ]
+ ],
+];
\ No newline at end of file
From 4c1b28f69a940fd5c8c1c40858b8b4b22f856762 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Wed, 21 Feb 2018 10:36:05 +0800
Subject: [PATCH 098/643] sg and memory
---
app/Breaker/UserBreaker.php | 4 ++--
app/Controllers/MiddlewareController.php | 4 ++--
app/Pool/Config/UserPoolConfig.php | 4 ++--
app/Services/MiddlewareService.php | 4 ++--
composer.json | 10 ++++++++--
5 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/app/Breaker/UserBreaker.php b/app/Breaker/UserBreaker.php
index 06b165ac..f1f9b23f 100644
--- a/app/Breaker/UserBreaker.php
+++ b/app/Breaker/UserBreaker.php
@@ -2,9 +2,9 @@
namespace App\Breaker;
-use Swoft\Bean\Annotation\Breaker;
+use Swoft\Sg\Bean\Annotation\Breaker;
use Swoft\Bean\Annotation\Value;
-use Swoft\Circuit\CircuitBreaker;
+use Swoft\Sg\Circuit\CircuitBreaker;
/**
* the breaker of user
diff --git a/app/Controllers/MiddlewareController.php b/app/Controllers/MiddlewareController.php
index 182ec394..572e335e 100644
--- a/app/Controllers/MiddlewareController.php
+++ b/app/Controllers/MiddlewareController.php
@@ -3,8 +3,8 @@
namespace App\Controllers;
use Swoft\Http\Server\Bean\Annotation\Controller;
-use Swoft\Bean\Annotation\Middleware;
-use Swoft\Bean\Annotation\Middlewares;
+use Swoft\Http\Message\Bean\Annotation\Middleware;
+use Swoft\Http\Message\Bean\Annotation\Middlewares;
use Swoft\Http\Server\Bean\Annotation\RequestMapping;
use App\Middlewares\GroupTestMiddleware;
use App\Middlewares\ActionTestMiddleware;
diff --git a/app/Pool/Config/UserPoolConfig.php b/app/Pool/Config/UserPoolConfig.php
index 644d58be..130e44cc 100644
--- a/app/Pool/Config/UserPoolConfig.php
+++ b/app/Pool/Config/UserPoolConfig.php
@@ -4,9 +4,9 @@
use Swoft\Bean\Annotation\Bean;
use Swoft\Bean\Annotation\Value;
-use Swoft\Pool\BalancerSelector;
+use Swoft\Sg\BalancerSelector;
use Swoft\Pool\PoolProperties;
-use Swoft\Pool\ProviderSelector;
+use Swoft\Sg\ProviderSelector;
/**
* the config of service user
diff --git a/app/Services/MiddlewareService.php b/app/Services/MiddlewareService.php
index b4c8687d..1bf6b5d5 100644
--- a/app/Services/MiddlewareService.php
+++ b/app/Services/MiddlewareService.php
@@ -5,8 +5,8 @@
use App\Lib\MdDemoInterface;
use App\Middlewares\ServiceMiddleware;
use App\Middlewares\ServiceSubMiddleware;
-use Swoft\Bean\Annotation\Middleware;
-use Swoft\Bean\Annotation\Middlewares;
+use Swoft\Http\Message\Bean\Annotation\Middleware;
+use Swoft\Http\Message\Bean\Annotation\Middlewares;
use Swoft\Rpc\Server\Bean\Annotation\Service;
/**
diff --git a/composer.json b/composer.json
index fe691401..4da02607 100644
--- a/composer.json
+++ b/composer.json
@@ -26,7 +26,9 @@
"swoft/devtool": "dev-master",
"swoft/session": "dev-master",
"swoft/i18n": "dev-master",
- "swoft/process": "dev-master"
+ "swoft/process": "dev-master",
+ "swoft/memory": "dev-master",
+ "swoft/sg": "dev-master"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
@@ -54,7 +56,11 @@
"repositories": [
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-process"
+ "url": "https://github.com/swoft-cloud/swoft-memory"
+ },
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-sg"
},
{
"type": "composer",
From 9a5e70c3c7c10c5448f3bdd168e29f314992a75a Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Wed, 21 Feb 2018 12:24:09 +0800
Subject: [PATCH 099/643] modify breaker
---
app/Breaker/UserBreaker.php | 5 -----
composer.json | 8 --------
2 files changed, 13 deletions(-)
diff --git a/app/Breaker/UserBreaker.php b/app/Breaker/UserBreaker.php
index f1f9b23f..00830b9e 100644
--- a/app/Breaker/UserBreaker.php
+++ b/app/Breaker/UserBreaker.php
@@ -10,11 +10,6 @@
* the breaker of user
*
* @Breaker("user")
- * @uses UserBreaker
- * @version 2017年12月14日
- * @author stelin
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
class UserBreaker extends CircuitBreaker
{
diff --git a/composer.json b/composer.json
index 4da02607..617a882a 100644
--- a/composer.json
+++ b/composer.json
@@ -54,14 +54,6 @@
"test": "./vendor/bin/phpunit -c phpunit.xml"
},
"repositories": [
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-memory"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-sg"
- },
{
"type": "composer",
"url": "https://packagist.phpcomposer.com/"
From f1aaa4e524003c973d0030b37816c372fed3e717 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Thu, 22 Feb 2018 09:26:08 +0800
Subject: [PATCH 100/643] rm desc
---
app/Commands/TestCommand.php | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/app/Commands/TestCommand.php b/app/Commands/TestCommand.php
index 6bdd70a5..3e18ea27 100644
--- a/app/Commands/TestCommand.php
+++ b/app/Commands/TestCommand.php
@@ -12,14 +12,9 @@
use Swoft\Log\Log;
/**
- * the group of test command
+ * Test command
*
* @Command(coroutine=true)
- * @uses TestCommand
- * @version 2017年11月03日
- * @author stelin
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
class TestCommand
{
From 5ffd8cd21122ec886abf5ef67358e55925fdb140 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Thu, 22 Feb 2018 13:16:17 +0800
Subject: [PATCH 101/643] modify config db
---
app/Boot/MyProcess.php | 2 +-
config/properties/app.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Boot/MyProcess.php b/app/Boot/MyProcess.php
index 193c72c0..6398c328 100644
--- a/app/Boot/MyProcess.php
+++ b/app/Boot/MyProcess.php
@@ -12,7 +12,7 @@
/**
* Custom process
*
- * @Process(boot=true)
+ * @Process(boot=false)
*/
class MyProcess implements ProcessInterface
{
diff --git a/config/properties/app.php b/config/properties/app.php
index 43ba53e3..eee41bdc 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -22,7 +22,7 @@
'sourceLanguage' => '@root/resources/messages/',
],
'env' => 'Base',
- 'database' => require __DIR__ . DS . 'db.php',
+ 'db' => require __DIR__ . DS . 'db.php',
'cache' => require __DIR__ . DS . 'cache.php',
'service' => require __DIR__ . DS . 'service.php',
'breaker' => require __DIR__ . DS . 'breaker.php',
From 584b44b142466189580920317b3e2e08eb91df0e Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 23 Feb 2018 20:41:03 +0800
Subject: [PATCH 102/643] rm redis params
---
.env.example | 3 ---
config/properties/cache.php | 3 ---
2 files changed, 6 deletions(-)
diff --git a/.env.example b/.env.example
index 0859907d..ac2fd563 100644
--- a/.env.example
+++ b/.env.example
@@ -61,9 +61,6 @@ REDIS_MAX_IDEL=6
REDIS_MAX_ACTIVE=10
REDIS_MAX_WAIT=20
REDIS_TIMEOUT=200
-REDIS_USE_PROVIDER=false
-REDIS_BALANCER=random
-REDIS_PROVIDER=consul
REDIS_SERIALIZE=1
# the pool of user service
diff --git a/config/properties/cache.php b/config/properties/cache.php
index 9855ba42..352fe8dd 100644
--- a/config/properties/cache.php
+++ b/config/properties/cache.php
@@ -10,9 +10,6 @@
'maxActive' => 8,
'maxWait' => 8,
'timeout' => 8,
- 'balancer' => 'random',
- 'useProvider' => false,
- 'provider' => 'consul',
'db' => 1,
'serialize' => 0,
],
From c9806983e2bf2e5625c4f429021aedf38c7c4643 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 23 Feb 2018 21:47:13 +0800
Subject: [PATCH 103/643] modify name
---
config/beans/base.php | 2 +-
test/Cases/AbstractTestCase.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/beans/base.php b/config/beans/base.php
index 67a05b1a..1a7fbf47 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -1,7 +1,7 @@
[
+ 'serverDispatcher' => [
'middlewares' => [
\Swoft\View\Middleware\ViewMiddleware::class,
\Swoft\Session\Middleware\SessionMiddleware::class,
diff --git a/test/Cases/AbstractTestCase.php b/test/Cases/AbstractTestCase.php
index efc724b2..d4ef72d7 100644
--- a/test/Cases/AbstractTestCase.php
+++ b/test/Cases/AbstractTestCase.php
@@ -52,7 +52,7 @@ public function request(
$response = new Response($swooleResponse);
/** @var \Swoft\Http\Server\ServerDispatcher $dispatcher */
- $dispatcher = App::getBean('ServerDispatcher');
+ $dispatcher = App::getBean('serverDispatcher');
return $dispatcher->dispatch($request, $response);;
}
From 567b1b5e4ef11b776c72ced0008b3a06f3863876 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 23 Feb 2018 22:19:05 +0800
Subject: [PATCH 104/643] add defer rpc
---
app/Controllers/RpcController.php | 15 +++++++++++++++
app/Lib/DemoInterface.php | 6 ++++++
app/Services/DemoService.php | 6 ++++++
app/Services/DemoServiceV2.php | 5 +++++
4 files changed, 32 insertions(+)
diff --git a/app/Controllers/RpcController.php b/app/Controllers/RpcController.php
index 50602346..f9d484f0 100644
--- a/app/Controllers/RpcController.php
+++ b/app/Controllers/RpcController.php
@@ -57,6 +57,21 @@ public function call()
];
}
+ /**
+ * Defer call
+ */
+ public function defer(){
+ $defer1 = $this->demoService->deferGetUser('123');
+ $defer2 = $this->demoServiceV2->deferGetUsers(['2', '3']);
+ $defer3 = $this->demoServiceV2->deferGetUserByCond(1, 2, 'boy', 1.6);
+
+ $result1 = $defer1->getResult();
+ $result2 = $defer2->getResult();
+ $result3 = $defer3->getResult();
+
+ return [$result1, $result2, $result3];
+ }
+
public function beanCall()
{
return [
diff --git a/app/Lib/DemoInterface.php b/app/Lib/DemoInterface.php
index b23eb536..1c7bcaf9 100644
--- a/app/Lib/DemoInterface.php
+++ b/app/Lib/DemoInterface.php
@@ -2,8 +2,14 @@
namespace App\Lib;
+use Swoft\Core\ResultInterface;
+
/**
* The interface of demo service
+ *
+ * @method ResultInterface deferGetUsers(array $ids)
+ * @method ResultInterface deferGetUser(string $id)
+ * @method ResultInterface deferGetUserByCond(int $type, int $uid, string $name, float $price, string $desc = "desc")
*/
interface DemoInterface
{
diff --git a/app/Services/DemoService.php b/app/Services/DemoService.php
index 822ea3a9..6cade9dd 100644
--- a/app/Services/DemoService.php
+++ b/app/Services/DemoService.php
@@ -8,9 +8,15 @@
use Swoft\Bean\Annotation\Number;
use Swoft\Bean\Annotation\Strings;
use Swoft\Rpc\Server\Bean\Annotation\Service;
+use Swoft\Core\ResultInterface;
/**
* Demo servcie
+ *
+ * @method ResultInterface deferGetUsers(array $ids)
+ * @method ResultInterface deferGetUser(string $id)
+ * @method ResultInterface deferGetUserByCond(int $type, int $uid, string $name, float $price, string $desc = "desc")
+ *
* @Service()
*/
class DemoService implements DemoInterface
diff --git a/app/Services/DemoServiceV2.php b/app/Services/DemoServiceV2.php
index b5e9d2cb..adafa101 100644
--- a/app/Services/DemoServiceV2.php
+++ b/app/Services/DemoServiceV2.php
@@ -8,9 +8,14 @@
use Swoft\Bean\Annotation\Number;
use Swoft\Bean\Annotation\Strings;
use Swoft\Rpc\Server\Bean\Annotation\Service;
+use Swoft\Core\ResultInterface;
/**
* Demo service
+ *
+ * @method ResultInterface deferGetUsers(array $ids)
+ * @method ResultInterface deferGetUser(string $id)
+ * @method ResultInterface deferGetUserByCond(int $type, int $uid, string $name, float $price, string $desc = "desc")
* @Service(version="1.0.1")
*/
class DemoServiceV2 implements DemoInterface
From 14c1020d5dda46ae72682b4cb8e9cbd39bf31869 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Sat, 24 Feb 2018 01:25:14 +0800
Subject: [PATCH 105/643] use swoft/service-governance instead of swoft/sg
---
composer.json | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/composer.json b/composer.json
index a9e1f1c1..44a722fd 100644
--- a/composer.json
+++ b/composer.json
@@ -28,7 +28,7 @@
"swoft/i18n": "dev-master",
"swoft/process": "dev-master",
"swoft/memory": "dev-master",
- "swoft/sg": "dev-master"
+ "swoft/service-governance": "dev-master"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
@@ -55,8 +55,8 @@
},
"repositories": [
{
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-framework"
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-framework"
},
{
"type": "composer",
From 047d7a7de3cd7cba1cadada3bcdf3cd75edc229d Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Sat, 24 Feb 2018 02:45:39 +0800
Subject: [PATCH 106/643] update MiddlewareController route info, and update
MiddlewareTest
---
app/Controllers/MiddlewareController.php | 17 ++++------
app/Middlewares/ActionTestMiddleware.php | 1 +
app/Middlewares/ControlerSubMiddleware.php | 6 ++--
app/Middlewares/ControlerTestMiddleware.php | 6 ++--
app/Middlewares/GroupTestMiddleware.php | 1 +
app/Middlewares/SubMiddleware.php | 4 ++-
test/Cases/MiddlewareTest.php | 37 ++++++++++-----------
test/Cases/RouteTest.php | 17 ++++++----
8 files changed, 45 insertions(+), 44 deletions(-)
diff --git a/app/Controllers/MiddlewareController.php b/app/Controllers/MiddlewareController.php
index 572e335e..3feb4552 100644
--- a/app/Controllers/MiddlewareController.php
+++ b/app/Controllers/MiddlewareController.php
@@ -14,8 +14,7 @@
/**
- * @Controller("md")
- *
+ * @Controller("middleware")
* @Middleware(class=ControlerTestMiddleware::class)
* @Middlewares({
* @Middleware(ControlerSubMiddleware::class)
@@ -24,37 +23,35 @@
class MiddlewareController
{
/**
- * @RequestMapping(route="caa")
- *
+ * @RequestMapping()
* @Middlewares({
* @Middleware(GroupTestMiddleware::class),
* @Middleware(ActionTestMiddleware::class)
* })
* @Middleware(SubMiddleware::class)
*/
- public function controllerAndAction()
+ public function action1(): array
{
return ['middleware'];
}
/**
- * @RequestMapping(route="caa2")
- *
+ * @RequestMapping()
* @Middleware(SubMiddleware::class)
* @Middlewares({
* @Middleware(GroupTestMiddleware::class),
* @Middleware(ActionTestMiddleware::class)
* })
*/
- public function controllerAndAction2()
+ public function action2(): array
{
return ['middleware2'];
}
/**
- * @RequestMapping("cm")
+ * @RequestMapping()
*/
- public function controlerMiddleware()
+ public function action3(): array
{
return ['middleware3'];
}
diff --git a/app/Middlewares/ActionTestMiddleware.php b/app/Middlewares/ActionTestMiddleware.php
index 385cb310..07c8f50d 100644
--- a/app/Middlewares/ActionTestMiddleware.php
+++ b/app/Middlewares/ActionTestMiddleware.php
@@ -27,6 +27,7 @@ class ActionTestMiddleware implements MiddlewareInterface
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Server\RequestHandlerInterface $handler
* @return \Psr\Http\Message\ResponseInterface
+ * @throws \InvalidArgumentException
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
diff --git a/app/Middlewares/ControlerSubMiddleware.php b/app/Middlewares/ControlerSubMiddleware.php
index e2f52a5c..a1ba52bb 100644
--- a/app/Middlewares/ControlerSubMiddleware.php
+++ b/app/Middlewares/ControlerSubMiddleware.php
@@ -21,14 +21,14 @@
class ControlerSubMiddleware implements MiddlewareInterface
{
/**
- * @param \Psr\Http\Message\ServerRequestInterface $request
+ * @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Server\RequestHandlerInterface $handler
- *
* @return \Psr\Http\Message\ResponseInterface
+ * @throws \InvalidArgumentException
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
- return $response->withAddedHeader('ControlerSubMiddleware', 'success');
+ return $response->withAddedHeader('Controler-Sub-Middleware', 'success');
}
}
\ No newline at end of file
diff --git a/app/Middlewares/ControlerTestMiddleware.php b/app/Middlewares/ControlerTestMiddleware.php
index 9ed158d2..ab621048 100644
--- a/app/Middlewares/ControlerTestMiddleware.php
+++ b/app/Middlewares/ControlerTestMiddleware.php
@@ -21,14 +21,14 @@
class ControlerTestMiddleware implements MiddlewareInterface
{
/**
- * @param \Psr\Http\Message\ServerRequestInterface $request
+ * @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Server\RequestHandlerInterface $handler
- *
* @return \Psr\Http\Message\ResponseInterface
+ * @throws \InvalidArgumentException
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
- return $response->withAddedHeader('ControlerTestMiddleware', 'success');
+ return $response->withAddedHeader('Controler-Test-Middleware', 'success');
}
}
\ No newline at end of file
diff --git a/app/Middlewares/GroupTestMiddleware.php b/app/Middlewares/GroupTestMiddleware.php
index 21cff7f9..0304134a 100644
--- a/app/Middlewares/GroupTestMiddleware.php
+++ b/app/Middlewares/GroupTestMiddleware.php
@@ -27,6 +27,7 @@ class GroupTestMiddleware implements MiddlewareInterface
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Server\RequestHandlerInterface $handler
* @return \Psr\Http\Message\ResponseInterface
+ * @throws \InvalidArgumentException
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
diff --git a/app/Middlewares/SubMiddleware.php b/app/Middlewares/SubMiddleware.php
index d940feb4..43bf0d4d 100644
--- a/app/Middlewares/SubMiddleware.php
+++ b/app/Middlewares/SubMiddleware.php
@@ -27,10 +27,12 @@ class SubMiddleware implements MiddlewareInterface
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Server\RequestHandlerInterface $handler
* @return \Psr\Http\Message\ResponseInterface
+ * @throws \InvalidArgumentException
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
- return $response->withAddedHeader('Sub-Middleware-Test', 'Success');
+ $response = $response->withAddedHeader('Sub-Middleware-Test', 'success');
+ return $response;
}
}
\ No newline at end of file
diff --git a/test/Cases/MiddlewareTest.php b/test/Cases/MiddlewareTest.php
index 53e41dd6..b5068279 100644
--- a/test/Cases/MiddlewareTest.php
+++ b/test/Cases/MiddlewareTest.php
@@ -3,48 +3,45 @@
namespace Swoft\Test\Cases;
/**
- * middleware teste
- *
- * @uses MiddlewareTest
- * @version 2017年11月29日
- * @author stelin
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
+ * Middleware test case
*/
class MiddlewareTest extends AbstractTestCase
{
/**
- * @covers \App\Controllers\MiddlewareController@controllerAndAction
+ * @covers \App\Controllers\MiddlewareController::action1
+ * @test
*/
- public function testControllerAndAction()
+ public function action1()
{
- $response = $this->request('GET', '/md/caa', [], parent::ACCEPT_JSON);
+ $response = $this->request('GET', '/middleware/action1', [], parent::ACCEPT_JSON);
$response->assertExactJson(['middleware']);
$response->assertHeader('Middleware-Group-Test', 'success');
- $response->assertHeader('Sub-Middleware-Test', 'Success');
+ $response->assertHeader('Sub-Middleware-Test', 'success');
$response->assertHeader('Middleware-Action-Test', 'success');
}
/**
- * @covers \App\Controllers\MiddlewareController@controllerAndAction2
+ * @covers \App\Controllers\MiddlewareController::action2
+ * @test
*/
- public function testControllerAndAction2()
+ public function action2()
{
- $response = $this->request('GET', '/md/caa2', [], parent::ACCEPT_JSON);
+ $response = $this->request('GET', '/middleware/action2', [], parent::ACCEPT_JSON);
$response->assertExactJson(['middleware2']);
$response->assertHeader('Middleware-Group-Test', 'success');
- $response->assertHeader('Sub-Middleware-Test', 'Success');
+ $response->assertHeader('Sub-Middleware-Test', 'success');
$response->assertHeader('Middleware-Action-Test', 'success');
}
/**
- * @covers \App\Controllers\MiddlewareController@controlerMiddleware
+ * @covers \App\Controllers\MiddlewareController::action3
+ * @test
*/
- public function testControlerMiddleware()
+ public function action3()
{
- $response = $this->request('GET', '/md/cm', [], parent::ACCEPT_JSON);
+ $response = $this->request('GET', '/middleware/action3', [], parent::ACCEPT_JSON);
$response->assertExactJson(['middleware3']);
- $response->assertHeader('ControlerTestMiddleware', 'success');
- $response->assertHeader('ControlerSubMiddleware', 'success');
+ $response->assertHeader('Controler-Test-Middleware', 'success');
+ $response->assertHeader('Controler-Sub-Middleware', 'success');
}
}
\ No newline at end of file
diff --git a/test/Cases/RouteTest.php b/test/Cases/RouteTest.php
index fe70fe5d..5f2a6d92 100644
--- a/test/Cases/RouteTest.php
+++ b/test/Cases/RouteTest.php
@@ -11,6 +11,9 @@
* @copyright Copyright 2010-2016 swoft software
* @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
+use Swoft\Http\Message\Testing\Web\Request;
+use Swoft\Http\Message\Testing\Web\Response;
+
class RouteTest extends AbstractTestCase
{
/**
@@ -23,8 +26,8 @@ public function testFuncArgs()
123,
true,
'test',
- "Swoft\\Http\\Message\\Testing\\Web\\Request",
- "Swoft\\Http\\Message\\Testing\\Web\\Response",
+ Request::class,
+ Response::class,
];
$response = $this->request('GET', '/route/user/123/book/456/1/test', [], parent::ACCEPT_JSON);
$response->assertExactJson($data);
@@ -45,7 +48,7 @@ public function testHasNotArg()
public function testHasAnyArgs()
{
$response = $this->request('GET', '/route/hasAnyArgs/123', [], parent::ACCEPT_JSON);
- $response->assertExactJson(["Swoft\\Http\\Message\\Testing\\Web\\Request", 123]);
+ $response->assertExactJson([Request::class, 123]);
}
/**
@@ -66,7 +69,7 @@ public function testOptionnalParameter()
public function testHasMoreArgs()
{
$response = $this->request('GET', '/route/hasMoreArgs', [], parent::ACCEPT_JSON);
- $response->assertExactJson(["Swoft\\Http\\Message\\Testing\\Web\\Request", 0]);
+ $response->assertExactJson([Request::class, 0]);
}
/**
@@ -75,7 +78,7 @@ public function testHasMoreArgs()
public function testNotAnnotation()
{
$response = $this->request('GET', '/route/notAnnotation', [], parent::ACCEPT_JSON);
- $response->assertExactJson(["Swoft\\Http\\Message\\Testing\\Web\\Request"]);
+ $response->assertExactJson([Request::class]);
}
/**
@@ -84,7 +87,7 @@ public function testNotAnnotation()
public function testOnlyFunc()
{
$response = $this->request('GET', '/route/onlyFunc', [], parent::ACCEPT_JSON);
- $response->assertExactJson(["Swoft\\Http\\Message\\Testing\\Web\\Request"]);
+ $response->assertExactJson([Request::class]);
}
/**
@@ -93,7 +96,7 @@ public function testOnlyFunc()
public function testBehindAction()
{
$response = $this->request('GET', '/route/behind', [], parent::ACCEPT_JSON);
- $response->assertExactJson(["Swoft\\Http\\Message\\Testing\\Web\\Request"]);
+ $response->assertExactJson([Request::class]);
}
/**
From 2628a6c92dfa0c13dc4ec9a5552e7f901aec2cfa Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Sat, 24 Feb 2018 02:46:04 +0800
Subject: [PATCH 107/643] modify serverDispatcher to ServerDispatcher
---
config/beans/base.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/beans/base.php b/config/beans/base.php
index 1a7fbf47..67a05b1a 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -1,7 +1,7 @@
[
+ 'ServerDispatcher' => [
'middlewares' => [
\Swoft\View\Middleware\ViewMiddleware::class,
\Swoft\Session\Middleware\SessionMiddleware::class,
From f14f5da58b168704a8d6f153e3da3d560670c4b1 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Sat, 24 Feb 2018 02:46:50 +0800
Subject: [PATCH 108/643] add json(), view(), raw() methods for quickly send a
mock request
---
test/Cases/AbstractTestCase.php | 112 +++++++++++++++++++++++++-------
1 file changed, 89 insertions(+), 23 deletions(-)
diff --git a/test/Cases/AbstractTestCase.php b/test/Cases/AbstractTestCase.php
index d4ef72d7..19f04ad0 100644
--- a/test/Cases/AbstractTestCase.php
+++ b/test/Cases/AbstractTestCase.php
@@ -11,11 +11,9 @@
use Swoft\Http\Message\Testing\Web\Response;
/**
- * @uses AbstractTestCase
- * @version 2017年11月03日
- * @author huangzhhui
- * @copyright Copyright 2010-2017 Swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
+ * Class AbstractTestCase
+ *
+ * @package Swoft\Test\Cases
*/
class AbstractTestCase extends TestCase
{
@@ -24,8 +22,10 @@ class AbstractTestCase extends TestCase
const ACCEPT_RAW = 'text/plain';
/**
- * @param $method
- * @param $uri
+ * Send a mock request
+ *
+ * @param string $method
+ * @param string $uri
* @param array $parameters
* @param string $accept
* @param array $headers
@@ -33,12 +33,12 @@ class AbstractTestCase extends TestCase
* @return bool|\Swoft\Http\Message\Testing\Web\Response
*/
public function request(
- $method,
- $uri,
- $parameters = [],
- $accept = self::ACCEPT_JSON,
- $headers = [],
- $rawContent = ''
+ string $method,
+ string $uri,
+ array $parameters = [],
+ string $accept = self::ACCEPT_JSON,
+ array $headers = [],
+ string $rawContent = ''
) {
$method = strtoupper($method);
$swooleResponse = new TestSwooleResponse();
@@ -52,20 +52,86 @@ public function request(
$response = new Response($swooleResponse);
/** @var \Swoft\Http\Server\ServerDispatcher $dispatcher */
- $dispatcher = App::getBean('serverDispatcher');
- return $dispatcher->dispatch($request, $response);;
+ $dispatcher = App::getBean('ServerDispatcher');
+ return $dispatcher->dispatch($request, $response);
}
/**
- * @param $method
- * @param $uri
- * @param $parameters
- * @param $accept
- * @param $swooleRequest
- * @param array $headers
+ * Send a mock json request
+ *
+ * @param string $method
+ * @param string $uri
+ * @param array $parameters
+ * @param array $headers
+ * @param string $rawContent
+ * @return bool|\Swoft\Http\Message\Testing\Web\Response
+ */
+ public function json(
+ string $method,
+ string $uri,
+ array $parameters = [],
+ array $headers = [],
+ string $rawContent = ''
+ ) {
+ return $this->request($method, $uri, $parameters, self::ACCEPT_JSON, $headers, $rawContent);
+ }
+
+ /**
+ * Send a mock view request
+ *
+ * @param string $method
+ * @param string $uri
+ * @param array $parameters
+ * @param array $headers
+ * @param string $rawContent
+ * @return bool|\Swoft\Http\Message\Testing\Web\Response
+ */
+ public function view(
+ string $method,
+ string $uri,
+ array $parameters = [],
+ array $headers = [],
+ string $rawContent = ''
+ ) {
+ return $this->request($method, $uri, $parameters, self::ACCEPT_VIEW, $headers, $rawContent);
+ }
+
+ /**
+ * Send a mock raw content request
+ *
+ * @param string $method
+ * @param string $uri
+ * @param array $parameters
+ * @param array $headers
+ * @param string $rawContent
+ * @return bool|\Swoft\Http\Message\Testing\Web\Response
*/
- protected function buildMockRequest($method, $uri, $parameters, $accept, &$swooleRequest, $headers = [])
- {
+ public function raw(
+ string $method,
+ string $uri,
+ array $parameters = [],
+ array $headers = [],
+ string $rawContent = ''
+ ) {
+ return $this->request($method, $uri, $parameters, self::ACCEPT_RAW, $headers, $rawContent);
+ }
+
+ /**
+ * @param string $method
+ * @param string $uri
+ * @param array $parameters
+ * @param string $accept
+ * @param \Swoole\Http\Request $swooleRequest
+ * @param array $headers
+ */
+ protected function buildMockRequest(
+ string $method,
+ string $uri,
+ array $parameters,
+ string $accept,
+ &$swooleRequest,
+ array $headers = []
+ ) {
$urlAry = parse_url(http://github.com/$uri);
$urlParams = [];
if (isset($urlAry['query'])) {
From 6b6bcc41bf253091d47e87ec28577935c60ab613 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sat, 24 Feb 2018 13:20:59 +0800
Subject: [PATCH 109/643] add repo
---
composer.json | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index a9e1f1c1..260cd4f9 100644
--- a/composer.json
+++ b/composer.json
@@ -28,7 +28,7 @@
"swoft/i18n": "dev-master",
"swoft/process": "dev-master",
"swoft/memory": "dev-master",
- "swoft/sg": "dev-master"
+ "swoft/service-governance": "dev-master"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
@@ -58,6 +58,10 @@
"type": "vcs",
"url": "https://github.com/swoft-cloud/swoft-framework"
},
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-service-governance"
+ },
{
"type": "composer",
"url": "https://packagist.phpcomposer.com/"
From c7f9df19619a2b35f77f71aa8efe634ae1910d61 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sat, 24 Feb 2018 14:26:21 +0800
Subject: [PATCH 110/643] fix bug
---
composer.json | 4 ++++
config/beans/base.php | 2 +-
config/properties/db.php | 8 ++++----
test/Cases/AbstractTestCase.php | 2 +-
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/composer.json b/composer.json
index 58c62189..768b11ac 100644
--- a/composer.json
+++ b/composer.json
@@ -62,6 +62,10 @@
"type": "vcs",
"url": "https://github.com/swoft-cloud/swoft-service-governance"
},
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-http-message"
+ },
{
"type": "composer",
"url": "https://packagist.phpcomposer.com/"
diff --git a/config/beans/base.php b/config/beans/base.php
index 67a05b1a..1a7fbf47 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -1,7 +1,7 @@
[
+ 'serverDispatcher' => [
'middlewares' => [
\Swoft\View\Middleware\ViewMiddleware::class,
\Swoft\Session\Middleware\SessionMiddleware::class,
diff --git a/config/properties/db.php b/config/properties/db.php
index 853672e9..9754c909 100644
--- a/config/properties/db.php
+++ b/config/properties/db.php
@@ -3,8 +3,8 @@
'master' => [
'name' => 'master',
'uri' => [
- '127.0.0.1:3306',
- '127.0.0.1:3306',
+ '127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
+ '127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
],
'maxIdel' => 8,
'maxActive' => 8,
@@ -18,8 +18,8 @@
'slave' => [
'name' => 'slave',
'uri' => [
- '127.0.0.1:3306',
- '127.0.0.1:3306',
+ '127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
+ '127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
],
'maxIdel' => 8,
'maxActive' => 8,
diff --git a/test/Cases/AbstractTestCase.php b/test/Cases/AbstractTestCase.php
index 19f04ad0..a25a1437 100644
--- a/test/Cases/AbstractTestCase.php
+++ b/test/Cases/AbstractTestCase.php
@@ -52,7 +52,7 @@ public function request(
$response = new Response($swooleResponse);
/** @var \Swoft\Http\Server\ServerDispatcher $dispatcher */
- $dispatcher = App::getBean('ServerDispatcher');
+ $dispatcher = App::getBean('serverDispatcher');
return $dispatcher->dispatch($request, $response);
}
From a9de7fda21081e5c4ea58adb1fa8ca393153a5a3 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Sat, 24 Feb 2018 15:40:15 +0800
Subject: [PATCH 111/643] use lowercase bean name
---
config/beans/base.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/beans/base.php b/config/beans/base.php
index 67a05b1a..1a7fbf47 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -1,7 +1,7 @@
[
+ 'serverDispatcher' => [
'middlewares' => [
\Swoft\View\Middleware\ViewMiddleware::class,
\Swoft\Session\Middleware\SessionMiddleware::class,
From 3c4a915bb737d01b024489428bf143e17f8ae041 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Sun, 25 Feb 2018 12:19:21 +0800
Subject: [PATCH 112/643] use single quotes
---
app/Controllers/DemoController.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/app/Controllers/DemoController.php b/app/Controllers/DemoController.php
index 91715478..aa86adc0 100644
--- a/app/Controllers/DemoController.php
+++ b/app/Controllers/DemoController.php
@@ -82,9 +82,9 @@ public function index(Request $request)
public function index2()
{
Coroutine::create(function () {
- App::trace("this is child trace" . Coroutine::id());
+ App::trace('this is child trace' . Coroutine::id());
Coroutine::create(function () {
- App::trace("this is child child trace" . Coroutine::id());
+ App::trace('this is child child trace' . Coroutine::id());
});
});
@@ -121,8 +121,8 @@ public function cor()
{
// 创建子协程
Coroutine::create(function () {
- App::error("child cor error msg");
- App::trace("child cor error msg");
+ App::error('child cor error msg');
+ App::trace('child cor error msg');
});
// 当前协程id
@@ -139,10 +139,10 @@ public function cor()
*/
public function i18n()
{
- $data[] = translate("title", [], 'zh');
- $data[] = translate("title", [], 'en');
- $data[] = translate("msg.body", ["stelin", 999], 'en');
- $data[] = translate("msg.body", ["stelin", 666], 'en');
+ $data[] = translate('title', [], 'zh');
+ $data[] = translate('title', [], 'en');
+ $data[] = translate('msg.body', ['stelin', 999], 'en');
+ $data[] = translate('msg.body', ['stelin', 666], 'en');
return $data;
}
From 54281429d237aaa887e065b88881779e87dcb4e9 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sun, 25 Feb 2018 16:44:07 +0800
Subject: [PATCH 113/643] rm config from db
---
.env.example | 6 ------
app/Controllers/HttpController.php | 24 ++++++++++++++++++++++++
app/Controllers/RedisController.php | 2 +-
config/properties/db.php | 6 ------
4 files changed, 25 insertions(+), 13 deletions(-)
create mode 100644 app/Controllers/HttpController.php
diff --git a/.env.example b/.env.example
index ac2fd563..3d534999 100644
--- a/.env.example
+++ b/.env.example
@@ -38,9 +38,6 @@ DB_MAX_IDEL=6
DB_MAX_ACTIVE=10
DB_MAX_WAIT=20
DB_TIMEOUT=200
-DB_USE_PROVIDER=false
-DB_BALANCER=random
-DB_PROVIDER=consul
# the pool of slave nodes pool
DB_SLAVE_NAME=dbSlave
@@ -49,9 +46,6 @@ DB_SLAVE_MAX_IDEL=6
DB_SLAVE_MAX_ACTIVE=10
DB_SLAVE_MAX_WAIT=20
DB_SLAVE_TIMEOUT=200
-DB_SLAVE_USE_PROVIDER=false
-DB_SLAVE_BALANCER=random
-DB_SLAVE_PROVIDER=consul
# the pool of redis
REDIS_NAME=redis
diff --git a/app/Controllers/HttpController.php b/app/Controllers/HttpController.php
new file mode 100644
index 00000000..c1bc0061
--- /dev/null
+++ b/app/Controllers/HttpController.php
@@ -0,0 +1,24 @@
+get('http://www.swoft.org/')->getResponse()->getBody()->getContents();
+ $response2 = $client->get('http://127.0.0.1/redis/testCache')->getResponse()->getBody()->getContents();
+ $response3 = $client->get('http://127.0.0.1/redis/testCache')->getResult()->getBody()->getContents();
+ return [$response, $response2, $response3];
+ }
+}
\ No newline at end of file
diff --git a/app/Controllers/RedisController.php b/app/Controllers/RedisController.php
index b7798cb6..dc0ef1db 100644
--- a/app/Controllers/RedisController.php
+++ b/app/Controllers/RedisController.php
@@ -34,7 +34,7 @@ public function testCache()
$this->redis->incrBy("count2", 2);
- return [$result, $name, $this->redis->get('count'), $this->redis->get('count2')];
+ return [$result, $name, $this->redis->get('count'), $this->redis->get('count2'), '3'];
}
public function testRedis()
diff --git a/config/properties/db.php b/config/properties/db.php
index 9754c909..d8721cc0 100644
--- a/config/properties/db.php
+++ b/config/properties/db.php
@@ -10,9 +10,6 @@
'maxActive' => 8,
'maxWait' => 8,
'timeout' => 8,
- 'balancer' => 'random',
- 'useProvider' => false,
- 'provider' => 'consul',
],
'slave' => [
@@ -25,8 +22,5 @@
'maxActive' => 8,
'maxWait' => 8,
'timeout' => 8,
- 'balancer' => 'random',
- 'useProvider' => false,
- 'provider' => 'consul',
],
];
\ No newline at end of file
From 0ed999d7aad8f6d4a69d359f08091416181af461 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sun, 25 Feb 2018 22:29:48 +0800
Subject: [PATCH 114/643] add http client
---
app/Tasks/SyncTask.php | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index 39859e39..716b9b0b 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -103,15 +103,12 @@ public function mysql(){
*/
public function http()
{
- $client = new Client([
- 'base_uri' => 'http://127.0.0.1/index/post?a=b',
- 'timeout' => 2,
- ]);
-
- $result = $client->post('http://127.0.0.1/index/post?a=b')->getResponse();
- $result2 = $client->get('http://www.baidu.com/');
- $data['result'] = $result;
- $data['result2'] = $result2;
+ $client = new Client();
+ $response = $client->get('http://www.swoft.org/')->getResponse()->getBody()->getContents();
+ $response2 = $client->get('http://127.0.0.1/redis/testCache')->getResponse()->getBody()->getContents();
+
+ $data['result1'] = $response;
+ $data['result2'] = $response2;
return $data;
}
From 778add726537d2da58b940b5f392215cac2b0ccf Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sun, 25 Feb 2018 22:38:23 +0800
Subject: [PATCH 115/643] modify composer
---
composer.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/composer.json b/composer.json
index 768b11ac..8e66db25 100644
--- a/composer.json
+++ b/composer.json
@@ -60,11 +60,11 @@
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-service-governance"
+ "url": "https://github.com/swoft-cloud/swoft-rpc-client"
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-http-message"
+ "url": "https://github.com/swoft-cloud/swoft-view"
},
{
"type": "composer",
From d3258fc125250417b4d1f4c0658dc870a95d1eb7 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sun, 25 Feb 2018 22:48:23 +0800
Subject: [PATCH 116/643] add process respo
---
composer.json | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/composer.json b/composer.json
index 8e66db25..969aac33 100644
--- a/composer.json
+++ b/composer.json
@@ -62,6 +62,10 @@
"type": "vcs",
"url": "https://github.com/swoft-cloud/swoft-rpc-client"
},
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-process"
+ },
{
"type": "vcs",
"url": "https://github.com/swoft-cloud/swoft-view"
From 00e02de2d81dd779f3e635109f86185fa6528c07 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Mon, 26 Feb 2018 02:02:55 +0800
Subject: [PATCH 117/643] format and clear up
---
.env.example | 12 ++++++------
composer.json | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/.env.example b/.env.example
index ac2fd563..4b5c7711 100644
--- a/.env.example
+++ b/.env.example
@@ -31,7 +31,7 @@ DISPATCH_MODE=2
LOG_FILE=@runtime/logs/swoole.log
TASK_WORKER_NUM=1
-# the pool of master nodes pool
+# Database Master nodes
DB_NAME=dbMaster
DB_URI=127.0.0.1:3306/test?user=root&password=123456&charset=utf8,127.0.0.1:3306/test?user=root&password=123456&charset=utf8
DB_MAX_IDEL=6
@@ -42,7 +42,7 @@ DB_USE_PROVIDER=false
DB_BALANCER=random
DB_PROVIDER=consul
-# the pool of slave nodes pool
+# Database Slave nodes
DB_SLAVE_NAME=dbSlave
DB_SLAVE_URI=127.0.0.1:3306/test?user=root&password=123456&charset=utf8,127.0.0.1:3306/test?user=root&password=123456&charset=utf8
DB_SLAVE_MAX_IDEL=6
@@ -53,7 +53,7 @@ DB_SLAVE_USE_PROVIDER=false
DB_SLAVE_BALANCER=random
DB_SLAVE_PROVIDER=consul
-# the pool of redis
+# Redis
REDIS_NAME=redis
REDIS_DB=2
REDIS_URI=127.0.0.1:6379,127.0.0.1:6379
@@ -63,7 +63,7 @@ REDIS_MAX_WAIT=20
REDIS_TIMEOUT=200
REDIS_SERIALIZE=1
-# the pool of user service
+# User service (demo service)
USER_POOL_NAME=user
USER_POOL_URI=127.0.0.1:8099,127.0.0.1:8099
USER_POOL_MAX_IDEL=6
@@ -74,12 +74,12 @@ USER_POOL_USE_PROVIDER=false
USER_POOL_BALANCER=random
USER_POOL_PROVIDER=consul
-# the breaker of user service
+# User service breaker (demo service)
USER_BREAKER_FAIL_COUNT = 3
USER_BREAKER_SUCCESS_COUNT = 6
USER_BREAKER_DELAY_TIME = 5000
-# the provider of consul
+# Consul
CONSUL_ADDRESS=http://127.0.0.1
CONSUL_PORT=8500
CONSUL_REGISTER_ETO=false
diff --git a/composer.json b/composer.json
index 768b11ac..1cdb94e4 100644
--- a/composer.json
+++ b/composer.json
@@ -59,12 +59,12 @@
"url": "https://github.com/swoft-cloud/swoft-framework"
},
{
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-service-governance"
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-service-governance"
},
{
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-http-message"
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-http-message"
},
{
"type": "composer",
From 14d868ae54df57693d392276ba7d96824f162526 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Mon, 26 Feb 2018 02:14:34 +0800
Subject: [PATCH 118/643] fixed request header test
---
test/Cases/IndexControllerTest.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/Cases/IndexControllerTest.php b/test/Cases/IndexControllerTest.php
index db6b48e0..5cc5af38 100644
--- a/test/Cases/IndexControllerTest.php
+++ b/test/Cases/IndexControllerTest.php
@@ -54,7 +54,7 @@ public function testIndex()
$this->assertInstanceOf(Response::class, $response);
/** @var Response $response */
$response->assertSuccessful()
- ->assertHeader('Content-Type', 'application/json')
+ ->assertHeaderContain('Content-Type', 'application/json')
->assertSee('Swoft')
->assertSeeText('New Generation of PHP Framework')
->assertDontSee('Swoole')
@@ -67,12 +67,12 @@ public function testIndex()
};
// Json model
$response = $this->request('GET', '/', [], parent::ACCEPT_JSON);
- $response->assertHeader('Content-Type', parent::ACCEPT_JSON);
+ $response->assertHeaderContain('Content-Type', parent::ACCEPT_JSON);
$jsonAssert($response);
// Raw model
$response = $this->request('GET', '/', [], parent::ACCEPT_RAW);
- $response->assertHeader('Content-Type', parent::ACCEPT_JSON);
+ $response->assertHeaderContain('Content-Type', parent::ACCEPT_JSON);
$jsonAssert($response);
// View model
@@ -81,7 +81,7 @@ public function testIndex()
->assertSee($expectedResult['name'])
->assertSee($expectedResult['notes'][0])
->assertSee($expectedResult['notes'][1])
- ->assertHeader('Content-Type', 'text/html');
+ ->assertHeaderContain('Content-Type', 'text/html');
// absolutePath
$response = $this->request('GET', '/index/absolutePath', [], parent::ACCEPT_VIEW);
From 2ac18f0137759baffb94f367c99f64ffbad03aff Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Mon, 26 Feb 2018 02:15:53 +0800
Subject: [PATCH 119/643] add latest HTTPClient use cases
---
app/Controllers/HttpClientController.php | 25 ++++++++++++++++++++++++
app/Controllers/HttpController.php | 24 -----------------------
2 files changed, 25 insertions(+), 24 deletions(-)
create mode 100644 app/Controllers/HttpClientController.php
delete mode 100644 app/Controllers/HttpController.php
diff --git a/app/Controllers/HttpClientController.php b/app/Controllers/HttpClientController.php
new file mode 100644
index 00000000..d567210f
--- /dev/null
+++ b/app/Controllers/HttpClientController.php
@@ -0,0 +1,25 @@
+get('https://www.swoft.org/')->getResult();
+ $result2 = $client->get('https://www.swoft.org/')->getResponse()->getBody()->getContents();
+ return compact('result', 'result2');
+ }
+}
\ No newline at end of file
diff --git a/app/Controllers/HttpController.php b/app/Controllers/HttpController.php
deleted file mode 100644
index c1bc0061..00000000
--- a/app/Controllers/HttpController.php
+++ /dev/null
@@ -1,24 +0,0 @@
-get('http://www.swoft.org/')->getResponse()->getBody()->getContents();
- $response2 = $client->get('http://127.0.0.1/redis/testCache')->getResponse()->getBody()->getContents();
- $response3 = $client->get('http://127.0.0.1/redis/testCache')->getResult()->getBody()->getContents();
- return [$response, $response2, $response3];
- }
-}
\ No newline at end of file
From 158533f5a7c993e49840a6a5b17eb1b2980ed394 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Mon, 26 Feb 2018 21:06:01 +0800
Subject: [PATCH 120/643] Update Dockerfile
Update maintainer email
---
Dockerfile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 46927a92..0082d47e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
FROM php:7.1
-MAINTAINER huangzhhui
+MAINTAINER huangzhhui
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo 'Asia/Shanghai' > /etc/timezone
@@ -10,7 +10,6 @@ RUN apt-get update \
curl \
wget \
git \
- vim \
zip \
libz-dev \
libssl-dev \
@@ -31,6 +30,7 @@ RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.
&& ldconfig \
) \
&& rm -r hiredis
+
RUN wget https://github.com/swoole/swoole-src/archive/v2.1.0.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
@@ -54,4 +54,4 @@ RUN composer install --no-dev \
EXPOSE 80
-CMD ["php", "/var/www/swoft/bin/swoft", "start"]
\ No newline at end of file
+CMD ["php", "/var/www/swoft/bin/swoft", "start"]
From 7a5fb27a4d4e4e984f34b489fbb58d5b1ebffd35 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Tue, 27 Feb 2018 23:52:43 +0800
Subject: [PATCH 121/643] Update HttpClient namespace
---
app/Controllers/HttpClientController.php | 2 +-
app/Tasks/SyncTask.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Controllers/HttpClientController.php b/app/Controllers/HttpClientController.php
index d567210f..f1d06128 100644
--- a/app/Controllers/HttpClientController.php
+++ b/app/Controllers/HttpClientController.php
@@ -2,7 +2,7 @@
namespace App\Controllers;
-use Swoft\Http\Client;
+use Swoft\HttpClient\Client;
use Swoft\Http\Server\Bean\Annotation\Controller;
/**
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index 716b9b0b..f9ca1554 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -6,7 +6,7 @@
use App\Models\Entity\User;
use Swoft\App;
use Swoft\Bean\Annotation\Inject;
-use Swoft\Http\Client;
+use Swoft\HttpClient\Client;
use Swoft\Rpc\Client\Bean\Annotation\Reference;
use Swoft\Task\Bean\Annotation\Scheduled;
use Swoft\Task\Bean\Annotation\Task;
From b5ff0fb30d0984cfef6f4d45d8089db34d874336 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Wed, 28 Feb 2018 00:49:19 +0800
Subject: [PATCH 122/643] add orm
---
app/Controllers/OrmController.php | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/app/Controllers/OrmController.php b/app/Controllers/OrmController.php
index 8b8d7afc..73a0cb71 100644
--- a/app/Controllers/OrmController.php
+++ b/app/Controllers/OrmController.php
@@ -200,9 +200,9 @@ public function find()
*/
public function arFindId()
{
- $result = User::findById(425)->getResult();
+ $result = User::findById(720)->getResult();
- $query = User::findById(426);
+ $query = User::findById(720);
/* @var User $user */
$user = $query->getResult(User::class);
@@ -279,21 +279,28 @@ public function ts()
$user->setDesc('this my desc');
$user->setAge(mt_rand(1, 100));
+ $user2 = new User();
+ $user2->setName('stelin');
+ $user2->setSex(1);
+ $user2->setDesc('this my desc');
+ $user2->setAge(mt_rand(1, 100));
+
$count = new Count();
$count->setFans(mt_rand(1, 1000));
$count->setFollows(mt_rand(1, 1000));
$em = EntityManager::create();
+ $re = $user2->save()->getResult();
$em->beginTransaction();
+
$uid = $em->save($user)->getResult();
$count->setUid($uid);
$result = $em->save($count)->getResult();
- if ($result === false) {
- $em->rollback();
- } else {
- $em->commit();
- }
+
+ $result2 = $user2->save()->getResult();
+ $em->rollback();
+// $em->commit();
$em->close();
return [$uid, $result];
From 61d8fe33220541e9b5e831392dd41c715dcb464a Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Wed, 28 Feb 2018 23:11:49 +0800
Subject: [PATCH 123/643] modify pool params
---
.env.example | 18 +++++++++++++-----
app/Pool/Config/UserPoolConfig.php | 22 +++++++++++++++++++---
config/properties/cache.php | 4 +++-
config/properties/db.php | 8 ++++++--
config/properties/service.php | 17 ++++++++++++++++-
5 files changed, 57 insertions(+), 12 deletions(-)
diff --git a/.env.example b/.env.example
index 6ca88adc..4dbcec91 100644
--- a/.env.example
+++ b/.env.example
@@ -37,33 +37,41 @@ DB_URI=127.0.0.1:3306/test?user=root&password=123456&charset=utf8,127.0.0.1:3306
DB_MAX_IDEL=6
DB_MAX_ACTIVE=10
DB_MAX_WAIT=20
+DB_MAX_WAIT_TIME=3
+DB_MAX_IDLE_TIME=60
DB_TIMEOUT=200
# Database Slave nodes
DB_SLAVE_NAME=dbSlave
DB_SLAVE_URI=127.0.0.1:3306/test?user=root&password=123456&charset=utf8,127.0.0.1:3306/test?user=root&password=123456&charset=utf8
-DB_SLAVE_MAX_IDEL=6
+DB_SLAVE_MIN_ACTIVE=5
DB_SLAVE_MAX_ACTIVE=10
DB_SLAVE_MAX_WAIT=20
-DB_SLAVE_TIMEOUT=200
+DB_SLAVE_MAX_WAIT_TIME=3
+DB_SLAVE_MAX_IDLE_TIME=60
+DB_SLAVE_TIMEOUT=3
# Redis
REDIS_NAME=redis
REDIS_DB=2
REDIS_URI=127.0.0.1:6379,127.0.0.1:6379
-REDIS_MAX_IDEL=6
+REDIS_MIN_ACTIVE=5
REDIS_MAX_ACTIVE=10
REDIS_MAX_WAIT=20
-REDIS_TIMEOUT=200
+REDIS_MAX_WAIT_TIME=3
+REDIS_MAX_IDLE_TIME=60
+REDIS_TIMEOUT=3
REDIS_SERIALIZE=1
# User service (demo service)
USER_POOL_NAME=user
USER_POOL_URI=127.0.0.1:8099,127.0.0.1:8099
-USER_POOL_MAX_IDEL=6
+USER_POOL_MIN_ACTIVE=5
USER_POOL_MAX_ACTIVE=10
USER_POOL_MAX_WAIT=20
USER_POOL_TIMEOUT=200
+USER_POOL_MAX_WAIT_TIME=3
+USER_POOL_MAX_IDLE_TIME=60
USER_POOL_USE_PROVIDER=false
USER_POOL_BALANCER=random
USER_POOL_PROVIDER=consul
diff --git a/app/Pool/Config/UserPoolConfig.php b/app/Pool/Config/UserPoolConfig.php
index 130e44cc..27500e46 100644
--- a/app/Pool/Config/UserPoolConfig.php
+++ b/app/Pool/Config/UserPoolConfig.php
@@ -29,12 +29,12 @@ class UserPoolConfig extends PoolProperties
protected $name = "";
/**
- * the maximum number of idle connections
+ * Minimum active number of connections
*
- * @Value(name="${config.service.user.maxIdel}", env="${USER_POOL_MAX_IDEL}")
+ * @Value(name="${config.service.user.minActive}", env="${USER_POOL_MIN_ACTIVE}")
* @var int
*/
- protected $maxIdel = 6;
+ protected $minActive = 5;
/**
* the maximum number of active connections
@@ -52,6 +52,22 @@ class UserPoolConfig extends PoolProperties
*/
protected $maxWait = 100;
+ /**
+ * Maximum waiting time
+ *
+ * @Value(name="${config.service.user.maxWaitTime}", env="${USER_POOL_MAX_WAIT_TIME}")
+ * @var int
+ */
+ protected $maxWaitTime = 3;
+
+ /**
+ * Maximum idle time
+ *
+ * @Value(name="${config.service.user.maxIdleTime}", env="${USER_POOL_MAX_IDLE_TIME}")
+ * @var int
+ */
+ protected $maxIdleTime = 60;
+
/**
* the time of connect timeout
*
diff --git a/config/properties/cache.php b/config/properties/cache.php
index 352fe8dd..175db1c1 100644
--- a/config/properties/cache.php
+++ b/config/properties/cache.php
@@ -6,9 +6,11 @@
'127.0.0.1:6379',
'127.0.0.1:6379',
],
- 'maxIdel' => 8,
+ 'minActive' => 8,
'maxActive' => 8,
'maxWait' => 8,
+ 'maxWaitTime' => 3,
+ 'maxIdleTime' => 60,
'timeout' => 8,
'db' => 1,
'serialize' => 0,
diff --git a/config/properties/db.php b/config/properties/db.php
index d8721cc0..2ab37d3f 100644
--- a/config/properties/db.php
+++ b/config/properties/db.php
@@ -6,10 +6,12 @@
'127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
'127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
],
- 'maxIdel' => 8,
+ 'minActive' => 8,
'maxActive' => 8,
'maxWait' => 8,
'timeout' => 8,
+ 'maxIdleTime' => 60,
+ 'maxWaitTime' => 3,
],
'slave' => [
@@ -18,9 +20,11 @@
'127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
'127.0.0.1:3306/test?user=root&password=123456&charset=utf8',
],
- 'maxIdel' => 8,
+ 'minActive' => 8,
'maxActive' => 8,
'maxWait' => 8,
'timeout' => 8,
+ 'maxIdleTime' => 60,
+ 'maxWaitTime' => 3,
],
];
\ No newline at end of file
diff --git a/config/properties/service.php b/config/properties/service.php
index 05e0b10e..e6d7df42 100644
--- a/config/properties/service.php
+++ b/config/properties/service.php
@@ -1,4 +1,19 @@
[
+ 'name' => 'redis',
+ 'uri' => [
+ '127.0.0.1:8099',
+ '127.0.0.1:8099',
+ ],
+ 'minActive' => 8,
+ 'maxActive' => 8,
+ 'maxWait' => 8,
+ 'maxWaitTime' => 3,
+ 'maxIdleTime' => 60,
+ 'timeout' => 8,
+ 'useProvider' => false,
+ 'balancer' => 'random',
+ 'provider' => 'consul',
+ ]
];
\ No newline at end of file
From 897240a67ee4f6e4c308271ee3705cab41d6d749 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Wed, 28 Feb 2018 23:34:54 +0800
Subject: [PATCH 124/643] modify .env.example
---
.env.example | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.env.example b/.env.example
index 4dbcec91..898ec0a7 100644
--- a/.env.example
+++ b/.env.example
@@ -34,11 +34,13 @@ TASK_WORKER_NUM=1
# Database Master nodes
DB_NAME=dbMaster
DB_URI=127.0.0.1:3306/test?user=root&password=123456&charset=utf8,127.0.0.1:3306/test?user=root&password=123456&charset=utf8
-DB_MAX_IDEL=6
+DB_MIN_ACTIVE=5
DB_MAX_ACTIVE=10
DB_MAX_WAIT=20
DB_MAX_WAIT_TIME=3
DB_MAX_IDLE_TIME=60
+DB_MAX_WAIT_TIME=3
+DB_MAX_IDLE_TIME=60
DB_TIMEOUT=200
# Database Slave nodes
From 9dd942271b8bd6e36bb17e5efec47101f5ea8289 Mon Sep 17 00:00:00 2001
From: kcloze <460309735@qq.com>
Date: Thu, 1 Mar 2018 23:11:32 +0800
Subject: [PATCH 125/643] add docker compose file and edit readme file
---
README.md | 6 +++++-
docker-compose.yaml | 11 +++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 docker-compose.yaml
diff --git a/README.md b/README.md
index a3032cc4..339b463f 100644
--- a/README.md
+++ b/README.md
@@ -64,9 +64,13 @@ QQ 交流群: 548173319
* `composer create-project swoft/swoft swoft dev-master`
## Docker 安装
-
+* `cd swoft`
* `docker run -p 80:80 swoft/swoft`
+## Docker-compose 安装
+* `cd swoft`
+* `docker-compose up -d`
+
# 配置
若在执行 `composer install` 的时候由程序自动复制环境变量配置文件失败,则可手动复制项目根目录的 `.env.example` 并命名为 `.env`,注意在执行 `composer update` 时并不会触发相关的复制操作
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644
index 00000000..530bdca4
--- /dev/null
+++ b/docker-compose.yaml
@@ -0,0 +1,11 @@
+version: '0.2'
+services:
+ swoft-dev:
+ image: swoft/swoft:latest
+ ports:
+ - "801:80"
+ volumes:
+ - ./:/var/www/swoft
+ stdin_open: true
+ tty: true
+ command: php /var/www/swoft/bin/swoft start
From c2adc92baf1647078743762006471435c86096cf Mon Sep 17 00:00:00 2001
From: kcloze <460309735@qq.com>
Date: Thu, 1 Mar 2018 23:27:23 +0800
Subject: [PATCH 126/643] change docker compose filename
---
docker-compose.yaml => docker-compose.yml | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename docker-compose.yaml => docker-compose.yml (100%)
diff --git a/docker-compose.yaml b/docker-compose.yml
similarity index 100%
rename from docker-compose.yaml
rename to docker-compose.yml
From 89cbbc35cbb686640e3b03bde8e671bd9b024c03 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 2 Mar 2018 00:10:33 +0800
Subject: [PATCH 127/643] fallback
---
app/Controllers/RpcController.php | 36 +++++++++++++++++++++++++++-
app/Fallback/DemoServiceFallback.php | 33 +++++++++++++++++++++++++
config/properties/app.php | 1 +
3 files changed, 69 insertions(+), 1 deletion(-)
create mode 100644 app/Fallback/DemoServiceFallback.php
diff --git a/app/Controllers/RpcController.php b/app/Controllers/RpcController.php
index f9d484f0..7bee9f4e 100644
--- a/app/Controllers/RpcController.php
+++ b/app/Controllers/RpcController.php
@@ -17,7 +17,7 @@ class RpcController
{
/**
- * @Reference("user")
+ * @Reference(name="user", fallback="demoFallback")
*
* @var DemoInterface
*/
@@ -42,6 +42,40 @@ class RpcController
*/
private $logic;
+
+ /**
+ * @return array
+ */
+ public function fallback()
+ {
+ $result1 = $this->demoService->getUser('11');
+ $result2 = $this->demoService->getUsers(['1','2']);
+ $result3 = $this->demoService->getUserByCond(1, 2, 'boy', 1.6);
+
+ return [
+ $result1,
+ $result2,
+ $result3,
+ ];
+ }
+
+ /**
+ * @return array
+ */
+ public function deferFallback()
+ {
+ $result1 = $this->demoService->deferGetUser('11')->getResult();
+ $result2 = $this->demoService->deferGetUsers(['1','2'])->getResult();
+ $result3 = $this->demoService->deferGetUserByCond(1, 2, 'boy', 1.6)->getResult();
+
+ return [
+ 'defer',
+ $result1,
+ $result2,
+ $result3,
+ ];
+ }
+
/**
* @RequestMapping(route="call")
* @return array
diff --git a/app/Fallback/DemoServiceFallback.php b/app/Fallback/DemoServiceFallback.php
new file mode 100644
index 00000000..5ba02d3e
--- /dev/null
+++ b/app/Fallback/DemoServiceFallback.php
@@ -0,0 +1,33 @@
+ [
'sourceLanguage' => '@root/resources/messages/',
From 952acf095de028d6b0b93bef20c0476336023e6a Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Fri, 2 Mar 2018 00:53:20 +0800
Subject: [PATCH 128/643] Update docker-compose.yml
---
docker-compose.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docker-compose.yml b/docker-compose.yml
index 530bdca4..7897b782 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,9 +1,9 @@
-version: '0.2'
+version: '2'
services:
swoft-dev:
image: swoft/swoft:latest
ports:
- - "801:80"
+ - "80:80"
volumes:
- ./:/var/www/swoft
stdin_open: true
From 5f4d4db8a4cd0b3681bea0c48bb0005246f066b3 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Fri, 2 Mar 2018 00:53:51 +0800
Subject: [PATCH 129/643] Update docker-compose.yml
---
docker-compose.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker-compose.yml b/docker-compose.yml
index 7897b782..c44f15f0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,6 @@
version: '2'
services:
- swoft-dev:
+ swoft:
image: swoft/swoft:latest
ports:
- "80:80"
From 8660e6ed3b485851ac78791eef70dc2c249adfea Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Fri, 2 Mar 2018 00:55:14 +0800
Subject: [PATCH 130/643] Update README.md
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 339b463f..5d544f49 100644
--- a/README.md
+++ b/README.md
@@ -64,12 +64,11 @@ QQ 交流群: 548173319
* `composer create-project swoft/swoft swoft dev-master`
## Docker 安装
-* `cd swoft`
* `docker run -p 80:80 swoft/swoft`
## Docker-compose 安装
* `cd swoft`
-* `docker-compose up -d`
+* `docker-compose up`
# 配置
From 3098adae849638ac2deb3461d4a4544225276d4e Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Fri, 2 Mar 2018 00:56:01 +0800
Subject: [PATCH 131/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5d544f49..3bdbf524 100644
--- a/README.md
+++ b/README.md
@@ -66,7 +66,7 @@ QQ 交流群: 548173319
## Docker 安装
* `docker run -p 80:80 swoft/swoft`
-## Docker-compose 安装
+## Docker-ompose 安装
* `cd swoft`
* `docker-compose up`
From 4ca605eb1d5b2b0afa1812f675116d225040c3ad Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Fri, 2 Mar 2018 00:56:28 +0800
Subject: [PATCH 132/643] Update README.md
---
README.md | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 3bdbf524..62709615 100644
--- a/README.md
+++ b/README.md
@@ -66,7 +66,7 @@ QQ 交流群: 548173319
## Docker 安装
* `docker run -p 80:80 swoft/swoft`
-## Docker-ompose 安装
+## Docker-Compose 安装
* `cd swoft`
* `docker-compose up`
@@ -180,11 +180,4 @@ php bin/swoft rpc:stop
[更新日志](changelog.md)
# 协议
-Swoft 的开源协议为 Apache-2.0,详情参见[LICENSE](LICENSE)。
-
-
-
-
-
-
-
+Swoft 的开源协议为 Apache-2.0,详情参见[LICENSE](LICENSE)
From 7fb516a7639143e75550637de59085b0fb915296 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Fri, 2 Mar 2018 01:02:56 +0800
Subject: [PATCH 133/643] add PACKAGE_MAX_LENGTH server setting
---
.env.example | 1 +
config/server.php | 1 +
2 files changed, 2 insertions(+)
diff --git a/.env.example b/.env.example
index 6ca88adc..c703a18d 100644
--- a/.env.example
+++ b/.env.example
@@ -30,6 +30,7 @@ DAEMONIZE=0
DISPATCH_MODE=2
LOG_FILE=@runtime/logs/swoole.log
TASK_WORKER_NUM=1
+PACKAGE_MAX_LENGTH=2048
# Database Master nodes
DB_NAME=dbMaster
diff --git a/config/server.php b/config/server.php
index 40f68c95..3e3a776d 100644
--- a/config/server.php
+++ b/config/server.php
@@ -32,6 +32,7 @@
'dispatch_mode' => env('DISPATCH_MODE', 2),
'log_file' => env('LOG_FILE', '@runtime/logs/swoole.log'),
'task_worker_num' => env('TASK_WORKER_NUM', 1),
+ 'package_max_length' => env('PACKAGE_MAX_LENGTH', 2048),
'upload_tmp_dir' => env('UPLOAD_TMP_DIR', '@runtime/uploadfiles'),
'document_root' => env('DOCUMENT_ROOT', BASE_PATH . '/public'),
'enable_static_handler' => env('ENABLE_STATIC_HANDLER', true),
From d8fac75284b68672995e252d3acc2b468c2b2db7 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Fri, 2 Mar 2018 01:38:01 +0800
Subject: [PATCH 134/643] Modify feature list
---
README.md | 21 +++++++++++----------
app/Controllers/HttpClientController.php | 1 +
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index a3032cc4..a67c1666 100644
--- a/README.md
+++ b/README.md
@@ -17,28 +17,29 @@
- 基于 Swoole 扩展
- 内置协程网络服务器
-- MVC 分层设计
-- 高性能路由
- 强大的 AOP (面向切面编程)
-- 灵活的注解功能
+- 灵活完善的注解功能
- 全局的依赖注入容器
- 基于 PSR-7 的 HTTP 消息实现
- 基于 PSR-14 的事件管理器
- 基于 PSR-15 的中间件
- 基于 PSR-16 的缓存设计
- 可扩展的高性能 RPC
-- RESTful 支持
-- 国际化(i18n)支持
-- 快速灵活的参数验证器
-- 完善的服务治理,熔断、降级、负载、注册与发现
-- 通用连接池 Mysql、Redis、RPC
+- 完善的服务治理,熔断,降级,负载,注册与发现
- 数据库 ORM
+- 通用连接池
+- 协程 Mysql, Redis, RPC, HTTP 客户端
+- 协程和同步阻塞客户端无缝自动切换
- 协程、异步任务投递
- 自定义用户进程
-- 协程和同步阻塞客户端无缝自动切换
+- RESTful 支持
+- 国际化(i18n)支持
+- 高性能路由
+- 快速灵活的参数验证器
- 别名机制
-- 跨平台热更新自动 Reload
- 强大的日志系统
+- 跨平台热更新自动 Reload
+
# 文档
[**中文文档**](https://doc.swoft.org)
diff --git a/app/Controllers/HttpClientController.php b/app/Controllers/HttpClientController.php
index f1d06128..0c7fcc17 100644
--- a/app/Controllers/HttpClientController.php
+++ b/app/Controllers/HttpClientController.php
@@ -12,6 +12,7 @@ class HttpClientController
{
/**
* @return array
+ * @throws \Swoft\HttpClient\Exception\RuntimeException
* @throws \RuntimeException
* @throws \InvalidArgumentException
*/
From 4c39b7f52573fbac6b6ef3bc0857931a5ca3a836 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Fri, 2 Mar 2018 02:06:31 +0800
Subject: [PATCH 135/643] add Redis extension
---
Dockerfile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Dockerfile b/Dockerfile
index 0082d47e..f654172d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,6 +19,8 @@ RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& composer self-update --clean-backups
+RUN pecl install redis && docker-php-ext-enable redis && pecl clear-cache
+
RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.gz \
&& mkdir -p hiredis \
&& tar -xf hiredis.tar.gz -C hiredis --strip-components=1 \
From 5089b0ac34361b87a6d8eeecdc44451bdfc03390 Mon Sep 17 00:00:00 2001
From: lixiaopei
Date: Fri, 2 Mar 2018 10:23:38 +0800
Subject: [PATCH 136/643] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20php-cs-fixer?=
=?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=96=87=E4=BB=B6=EF=BC=8C=E7=BB=9F=E4=B8=80?=
=?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.php_cs | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 .php_cs
diff --git a/.php_cs b/.php_cs
new file mode 100644
index 00000000..48d22525
--- /dev/null
+++ b/.php_cs
@@ -0,0 +1,46 @@
+
+For the full copyright and license information, please view the LICENSE
+file that was distributed with this source code.
+EOF;
+
+return PhpCsFixer\Config::create()
+ ->setRiskyAllowed(true)
+ ->setRules([
+ '@Symfony' => true,
+ '@Symfony:risky' => true,
+ 'array_syntax' => ['syntax' => 'short'],
+ 'combine_consecutive_unsets' => true,
+ // one should use PHPUnit methods to set up expected exception instead of annotations
+ 'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
+ 'header_comment' => ['header' => $header],
+ 'heredoc_to_nowdoc' => true,
+ 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
+ 'no_unreachable_default_argument_value' => true,
+ 'no_useless_else' => true,
+ 'no_useless_return' => true,
+ 'ordered_class_elements' => true,
+ 'ordered_imports' => true,
+ 'php_unit_strict' => true,
+ 'phpdoc_add_missing_param_annotation' => true,
+ 'phpdoc_order' => true,
+ 'psr4' => true,
+ 'strict_comparison' => false,
+ 'strict_param' => true,
+ 'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
+ 'concat_space' => ['spacing' => 'one'],
+ 'no_empty_statement' => true,
+ 'simplified_null_return' => true,
+ 'no_extra_consecutive_blank_lines' => true,
+ 'pre_increment' => false
+ ])
+ ->setFinder(
+ PhpCsFixer\Finder::create()
+ ->exclude('vendor')
+ ->exclude('runtime')
+ ->in(__DIR__)
+ )
+ ->setUsingCache(false)
+;
\ No newline at end of file
From 03534785d57e5df83e3ec9b79c0a7df7eacaeb20 Mon Sep 17 00:00:00 2001
From: lixiaopei
Date: Fri, 2 Mar 2018 10:29:01 +0800
Subject: [PATCH 137/643] =?UTF-8?q?=E4=BF=AE=E6=94=B9php-cs-fixer=E6=A8=A1?=
=?UTF-8?q?=E6=9D=BF=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.php_cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/.php_cs b/.php_cs
index 48d22525..4587fe8b 100644
--- a/.php_cs
+++ b/.php_cs
@@ -1,6 +1,6 @@
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
@@ -13,7 +13,6 @@ return PhpCsFixer\Config::create()
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
- // one should use PHPUnit methods to set up expected exception instead of annotations
'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
'header_comment' => ['header' => $header],
'heredoc_to_nowdoc' => true,
From 8d9186dbd062a5ad663548b115f1ec3aa6192145 Mon Sep 17 00:00:00 2001
From: daydaygo <1252409767@qq.com>
Date: Mon, 5 Mar 2018 18:01:26 +0800
Subject: [PATCH 138/643] fix 'model -> mode'
---
.env.example | 4 ++--
composer.json | 36 ++++++++++++++++++++++++++++++------
config/server.php | 4 ++--
3 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/.env.example b/.env.example
index 4d819def..08eedddb 100644
--- a/.env.example
+++ b/.env.example
@@ -8,13 +8,13 @@ AUTO_RELOAD=true
# HTTP
HTTP_HOST=0.0.0.0
HTTP_PORT=80
-HTTP_MODEL=SWOOLE_PROCESS
+HTTP_MODE=SWOOLE_PROCESS
HTTP_TYPE=SWOOLE_SOCK_TCP
# TCP
TCP_HOST=0.0.0.0
TCP_PORT=8099
-TCP_MODEL=SWOOLE_PROCESS
+TCP_MODE=SWOOLE_PROCESS
TCP_TYPE=SWOOLE_SOCK_TCP
TCP_PACKAGE_MAX_LENGTH=2048
TCP_OPEN_EOF_CHECK=false
diff --git a/composer.json b/composer.json
index 8655a7f9..1d98f65a 100644
--- a/composer.json
+++ b/composer.json
@@ -56,27 +56,51 @@
"repositories": [
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-framework"
+ "url": "git@github.com:daydaygo/swoft-framework.git"
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-service-governance"
+ "url": "git@github.com:daydaygo/swoft-cache.git"
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-rpc-client"
+ "url": "git@github.com:daydaygo/swoft-session.git"
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-http-message"
+ "url": "git@github.com:daydaygo/swoft-db.git"
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-process"
+ "url": "git@github.com:daydaygo/swoft-task.git"
+ },
+ {
+ "type": "vcs",
+ "url": "git@github.com:daydaygo/swoft-view.git"
+ },
+ {
+ "type": "vcs",
+ "url": "git@github.com:daydaygo/swoft-http-server.git"
+ },
+ {
+ "type": "vcs",
+ "url": "git@github.com:daydaygo/swoft-rpc-server.git"
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-view"
+ "url": "git@github.com:daydaygo/swoft-rpc-client.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-service-governance"
+ },
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-http-message"
+ },
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-process"
},
{
"type": "composer",
diff --git a/config/server.php b/config/server.php
index 3e3a776d..9cd4fe82 100644
--- a/config/server.php
+++ b/config/server.php
@@ -10,7 +10,7 @@
'tcp' => [
'host' => env('TCP_HOST', '0.0.0.0'),
'port' => env('TCP_PORT', 8099),
- 'model' => env('TCP_MODEL', SWOOLE_PROCESS),
+ 'mode' => env('TCP_MODE', SWOOLE_PROCESS),
'type' => env('TCP_TYPE', SWOOLE_SOCK_TCP),
'package_max_length' => env('TCP_PACKAGE_MAX_LENGTH', 2048),
'open_eof_check' => env('TCP_OPEN_EOF_CHECK', false),
@@ -18,7 +18,7 @@
'http' => [
'host' => env('HTTP_HOST', '0.0.0.0'),
'port' => env('HTTP_PORT', 80),
- 'model' => env('HTTP_MODEL', SWOOLE_PROCESS),
+ 'mode' => env('HTTP_MODE', SWOOLE_PROCESS),
'type' => env('HTTP_TYPE', SWOOLE_SOCK_TCP),
],
'crontab' => [
From 8241a77a41e91e13865a1bf2c6452e7e5cbb4b7d Mon Sep 17 00:00:00 2001
From: daydaygo <1252409767@qq.com>
Date: Mon, 5 Mar 2018 18:09:48 +0800
Subject: [PATCH 139/643] update
---
composer.json | 36 ++++++------------------------------
1 file changed, 6 insertions(+), 30 deletions(-)
diff --git a/composer.json b/composer.json
index 1d98f65a..8655a7f9 100644
--- a/composer.json
+++ b/composer.json
@@ -56,51 +56,27 @@
"repositories": [
{
"type": "vcs",
- "url": "git@github.com:daydaygo/swoft-framework.git"
+ "url": "https://github.com/swoft-cloud/swoft-framework"
},
{
"type": "vcs",
- "url": "git@github.com:daydaygo/swoft-cache.git"
- },
- {
- "type": "vcs",
- "url": "git@github.com:daydaygo/swoft-session.git"
- },
- {
- "type": "vcs",
- "url": "git@github.com:daydaygo/swoft-db.git"
- },
- {
- "type": "vcs",
- "url": "git@github.com:daydaygo/swoft-task.git"
- },
- {
- "type": "vcs",
- "url": "git@github.com:daydaygo/swoft-view.git"
- },
- {
- "type": "vcs",
- "url": "git@github.com:daydaygo/swoft-http-server.git"
- },
- {
- "type": "vcs",
- "url": "git@github.com:daydaygo/swoft-rpc-server.git"
+ "url": "https://github.com/swoft-cloud/swoft-service-governance"
},
{
"type": "vcs",
- "url": "git@github.com:daydaygo/swoft-rpc-client.git"
+ "url": "https://github.com/swoft-cloud/swoft-rpc-client"
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-service-governance"
+ "url": "https://github.com/swoft-cloud/swoft-http-message"
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-http-message"
+ "url": "https://github.com/swoft-cloud/swoft-process"
},
{
"type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-process"
+ "url": "https://github.com/swoft-cloud/swoft-view"
},
{
"type": "composer",
From 8585941c5bf2bf83b6dfb10aae2056354085da5f Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Mon, 5 Mar 2018 18:17:28 +0800
Subject: [PATCH 140/643] add sql case
---
app/Controllers/OrmController.php | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/app/Controllers/OrmController.php b/app/Controllers/OrmController.php
index 73a0cb71..6678a94c 100644
--- a/app/Controllers/OrmController.php
+++ b/app/Controllers/OrmController.php
@@ -48,6 +48,15 @@ public function arSave()
return [$userResult, $countResult, $directUser, $directCount];
}
+ public function test(){
+ $sql = "select * from user";
+ $em = EntityManager::create();
+ $result = $em->createQuery($sql)->execute()->getResult();
+ $em->close();
+
+ return [$result];
+ }
+
/**
* EM查找
*/
From ec946b76498086b78ef06c9271bc34d2a0b09634 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Tue, 6 Mar 2018 21:35:50 +0800
Subject: [PATCH 141/643] add consul provider
---
.env.example | 9 +++++----
app/Pool/Config/UserPoolConfig.php | 11 ++---------
app/Pool/UserServicePool.php | 6 ------
config/beans/base.php | 2 +-
config/properties/app.php | 1 +
config/properties/provider.php | 6 +++---
6 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/.env.example b/.env.example
index 4d819def..24f7f94d 100644
--- a/.env.example
+++ b/.env.example
@@ -4,6 +4,7 @@ PNAME=php-swoft
TCPABLE=true
CRONABLE=false
AUTO_RELOAD=true
+AUTO_REGISTER=false
# HTTP
HTTP_HOST=0.0.0.0
@@ -87,11 +88,11 @@ USER_BREAKER_DELAY_TIME = 5000
# Consul
CONSUL_ADDRESS=http://127.0.0.1
CONSUL_PORT=8500
+CONSUL_REGISTER_NAME=user
CONSUL_REGISTER_ETO=false
-CONSUL_REGISTER_SERVICE_ADDRESS=http://127.0.0.1
-CONSUL_REGISTER_SERVICE_PORT=88
+CONSUL_REGISTER_SERVICE_ADDRESS=127.0.0.1
+CONSUL_REGISTER_SERVICE_PORT=8099
CONSUL_REGISTER_CHECK_NAME=user
CONSUL_REGISTER_CHECK_TCP=127.0.0.1:8099
CONSUL_REGISTER_CHECK_INTERVAL=10
-CONSUL_REGISTER_CHECK_TIMEOUT=1
-CONSUL_DISCOVERY_NAME=user
\ No newline at end of file
+CONSUL_REGISTER_CHECK_TIMEOUT=1
\ No newline at end of file
diff --git a/app/Pool/Config/UserPoolConfig.php b/app/Pool/Config/UserPoolConfig.php
index 27500e46..628fa386 100644
--- a/app/Pool/Config/UserPoolConfig.php
+++ b/app/Pool/Config/UserPoolConfig.php
@@ -4,19 +4,12 @@
use Swoft\Bean\Annotation\Bean;
use Swoft\Bean\Annotation\Value;
-use Swoft\Sg\BalancerSelector;
use Swoft\Pool\PoolProperties;
-use Swoft\Sg\ProviderSelector;
/**
* the config of service user
*
* @Bean()
- * @uses UserPoolConfig
- * @version 2017年12月16日
- * @author stelin
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
class UserPoolConfig extends PoolProperties
{
@@ -105,7 +98,7 @@ class UserPoolConfig extends PoolProperties
* @Value(name="${config.service.user.balancer}", env="${USER_POOL_BALANCER}")
* @var string
*/
- protected $balancer = BalancerSelector::TYPE_RANDOM;
+ protected $balancer = "";
/**
* the default provider is consul provider
@@ -113,5 +106,5 @@ class UserPoolConfig extends PoolProperties
* @Value(name="${config.service.user.provider}", env="${USER_POOL_PROVIDER}")
* @var string
*/
- protected $provider = ProviderSelector::TYPE_CONSUL;
+ protected $provider = "";
}
\ No newline at end of file
diff --git a/app/Pool/UserServicePool.php b/app/Pool/UserServicePool.php
index 25d4e430..34e5d259 100644
--- a/app/Pool/UserServicePool.php
+++ b/app/Pool/UserServicePool.php
@@ -11,12 +11,6 @@
* the pool of user service
*
* @Pool(name="user")
- *
- * @uses UserServicePool
- * @version 2017年12月14日
- * @author stelin
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
class UserServicePool extends ServicePool
{
diff --git a/config/beans/base.php b/config/beans/base.php
index 1a7fbf47..d4110c58 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -22,5 +22,5 @@
],
'cache' => [
'driver' => 'redis',
- ]
+ ],
];
diff --git a/config/properties/app.php b/config/properties/app.php
index 712e83ca..bd48e6bd 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -27,4 +27,5 @@
'cache' => require __DIR__ . DS . 'cache.php',
'service' => require __DIR__ . DS . 'service.php',
'breaker' => require __DIR__ . DS . 'breaker.php',
+ 'provider' => require __DIR__ . DS . 'provider.php',
];
\ No newline at end of file
diff --git a/config/properties/provider.php b/config/properties/provider.php
index 0d6e59e8..87951522 100644
--- a/config/properties/provider.php
+++ b/config/properties/provider.php
@@ -9,13 +9,13 @@
'tags' => [],
'enableTagOverride' => false,
'service' => [
- 'address' => 'http://127.0.0.1/',
- 'port' => '88',
+ 'address' => 'localhost',
+ 'port' => '8099',
],
'check' => [
'id' => '',
'name' => '',
- 'tcp' => 'localhost:22',
+ 'tcp' => 'localhost:8099',
'interval' => 10,
'timeout' => 1,
],
From 589067568afc46c8aecf8fd5d9f500623b683559 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Tue, 6 Mar 2018 22:43:55 +0800
Subject: [PATCH 142/643] modify composer
---
composer.json | 62 ++++++++++++++++-----------------------------------
1 file changed, 19 insertions(+), 43 deletions(-)
diff --git a/composer.json b/composer.json
index 8655a7f9..1a39e870 100644
--- a/composer.json
+++ b/composer.json
@@ -10,25 +10,25 @@
"license": "Apache-2.0",
"require": {
"php": ">=7.0",
- "swoft/framework": "dev-master",
- "swoft/rpc": "dev-master",
- "swoft/rpc-server": "dev-master",
- "swoft/rpc-client": "dev-master",
- "swoft/http-server": "dev-master",
- "swoft/http-client": "dev-master",
- "swoft/task": "dev-master",
- "swoft/http-message": "dev-master",
- "swoft/view": "dev-master",
- "swoft/db": "dev-master",
- "swoft/cache": "dev-master",
- "swoft/redis": "dev-master",
- "swoft/console": "dev-master",
- "swoft/devtool": "dev-master",
- "swoft/session": "dev-master",
- "swoft/i18n": "dev-master",
- "swoft/process": "dev-master",
- "swoft/memory": "dev-master",
- "swoft/service-governance": "dev-master"
+ "swoft/framework": "^1.0",
+ "swoft/rpc": "^1.0",
+ "swoft/rpc-server": "^1.0",
+ "swoft/rpc-client": "^1.0",
+ "swoft/http-server": "^1.0",
+ "swoft/http-client": "^1.0",
+ "swoft/task": "^1.0",
+ "swoft/http-message": "^1.0",
+ "swoft/view": "^1.0",
+ "swoft/db": "^1.0",
+ "swoft/cache": "^1.0",
+ "swoft/redis": "^1.0",
+ "swoft/console": "^1.0",
+ "swoft/devtool": "^1.0",
+ "swoft/session": "^1.0",
+ "swoft/i18n": "^1.0",
+ "swoft/process": "^1.0",
+ "swoft/memory": "^1.0",
+ "swoft/service-governance": "^1.0"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
@@ -54,30 +54,6 @@
"test": "./vendor/bin/phpunit -c phpunit.xml"
},
"repositories": [
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-framework"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-service-governance"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-rpc-client"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-http-message"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-process"
- },
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-view"
- },
{
"type": "composer",
"url": "https://packagist.phpcomposer.com/"
From bd1edef4bcc75fcb6817a043f0f8a1004b047b68 Mon Sep 17 00:00:00 2001
From: kcloze <460309735@qq.com>
Date: Wed, 7 Mar 2018 00:17:05 +0800
Subject: [PATCH 143/643] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=87=AA=E5=AE=9A?=
=?UTF-8?q?=E4=B9=89=E7=BC=96=E7=A0=81=E8=A7=84=E8=8C=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.php_cs | 59 +++++++++++++++++++++++++++++----------------------------
1 file changed, 30 insertions(+), 29 deletions(-)
diff --git a/.php_cs b/.php_cs
index 4587fe8b..f56582fd 100644
--- a/.php_cs
+++ b/.php_cs
@@ -1,4 +1,5 @@
@@ -7,34 +8,34 @@ file that was distributed with this source code.
EOF;
return PhpCsFixer\Config::create()
- ->setRiskyAllowed(true)
- ->setRules([
- '@Symfony' => true,
- '@Symfony:risky' => true,
- 'array_syntax' => ['syntax' => 'short'],
- 'combine_consecutive_unsets' => true,
- 'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
- 'header_comment' => ['header' => $header],
- 'heredoc_to_nowdoc' => true,
- 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
- 'no_unreachable_default_argument_value' => true,
- 'no_useless_else' => true,
- 'no_useless_return' => true,
- 'ordered_class_elements' => true,
- 'ordered_imports' => true,
- 'php_unit_strict' => true,
- 'phpdoc_add_missing_param_annotation' => true,
- 'phpdoc_order' => true,
- 'psr4' => true,
- 'strict_comparison' => false,
- 'strict_param' => true,
- 'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
- 'concat_space' => ['spacing' => 'one'],
- 'no_empty_statement' => true,
- 'simplified_null_return' => true,
- 'no_extra_consecutive_blank_lines' => true,
- 'pre_increment' => false
- ])
+ // ->setRiskyAllowed(true)
+ // ->setRules([
+ // '@Symfony' => true,
+ // '@Symfony:risky' => true,
+ // 'array_syntax' => ['syntax' => 'short'],
+ // 'combine_consecutive_unsets' => true,
+ // 'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
+ // 'header_comment' => ['header' => $header],
+ // 'heredoc_to_nowdoc' => true,
+ // 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
+ // 'no_unreachable_default_argument_value' => true,
+ // 'no_useless_else' => true,
+ // 'no_useless_return' => true,
+ // 'ordered_class_elements' => true,
+ // 'ordered_imports' => true,
+ // 'php_unit_strict' => true,
+ // 'phpdoc_add_missing_param_annotation' => true,
+ // 'phpdoc_order' => true,
+ // 'psr4' => true,
+ // 'strict_comparison' => false,
+ // 'strict_param' => true,
+ // 'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
+ // 'concat_space' => ['spacing' => 'one'],
+ // 'no_empty_statement' => true,
+ // 'simplified_null_return' => true,
+ // 'no_extra_consecutive_blank_lines' => true,
+ // 'pre_increment' => false
+ // ])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
@@ -42,4 +43,4 @@ return PhpCsFixer\Config::create()
->in(__DIR__)
)
->setUsingCache(false)
-;
\ No newline at end of file
+;
From bfb059524c1a87bf337e8b6702bc8ae145064c3d Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Wed, 7 Mar 2018 12:02:58 +0800
Subject: [PATCH 144/643] Update .php_cs
Remove useless code
---
.php_cs | 31 +------------------------------
1 file changed, 1 insertion(+), 30 deletions(-)
diff --git a/.php_cs b/.php_cs
index f56582fd..eaaf7963 100644
--- a/.php_cs
+++ b/.php_cs
@@ -8,39 +8,10 @@ file that was distributed with this source code.
EOF;
return PhpCsFixer\Config::create()
- // ->setRiskyAllowed(true)
- // ->setRules([
- // '@Symfony' => true,
- // '@Symfony:risky' => true,
- // 'array_syntax' => ['syntax' => 'short'],
- // 'combine_consecutive_unsets' => true,
- // 'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
- // 'header_comment' => ['header' => $header],
- // 'heredoc_to_nowdoc' => true,
- // 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
- // 'no_unreachable_default_argument_value' => true,
- // 'no_useless_else' => true,
- // 'no_useless_return' => true,
- // 'ordered_class_elements' => true,
- // 'ordered_imports' => true,
- // 'php_unit_strict' => true,
- // 'phpdoc_add_missing_param_annotation' => true,
- // 'phpdoc_order' => true,
- // 'psr4' => true,
- // 'strict_comparison' => false,
- // 'strict_param' => true,
- // 'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
- // 'concat_space' => ['spacing' => 'one'],
- // 'no_empty_statement' => true,
- // 'simplified_null_return' => true,
- // 'no_extra_consecutive_blank_lines' => true,
- // 'pre_increment' => false
- // ])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->exclude('runtime')
->in(__DIR__)
)
- ->setUsingCache(false)
-;
+ ->setUsingCache(false);
From 21c0d99fbe388da6e0c8078b5ffca89e1e0d7846 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Wed, 7 Mar 2018 12:03:31 +0800
Subject: [PATCH 145/643] Update UserPoolConfig.php
Use single quote
---
app/Pool/Config/UserPoolConfig.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/Pool/Config/UserPoolConfig.php b/app/Pool/Config/UserPoolConfig.php
index 628fa386..57723c20 100644
--- a/app/Pool/Config/UserPoolConfig.php
+++ b/app/Pool/Config/UserPoolConfig.php
@@ -19,7 +19,7 @@ class UserPoolConfig extends PoolProperties
* @Value(name="${config.service.user.name}", env="${USER_POOL_NAME}")
* @var string
*/
- protected $name = "";
+ protected $name = '';
/**
* Minimum active number of connections
@@ -98,7 +98,7 @@ class UserPoolConfig extends PoolProperties
* @Value(name="${config.service.user.balancer}", env="${USER_POOL_BALANCER}")
* @var string
*/
- protected $balancer = "";
+ protected $balancer = '';
/**
* the default provider is consul provider
@@ -106,5 +106,5 @@ class UserPoolConfig extends PoolProperties
* @Value(name="${config.service.user.provider}", env="${USER_POOL_PROVIDER}")
* @var string
*/
- protected $provider = "";
-}
\ No newline at end of file
+ protected $provider = '';
+}
From 46fcf0451d87c081fc2c7458e6812ab6dee3af42 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Wed, 7 Mar 2018 15:53:12 +0800
Subject: [PATCH 146/643] Update Dockerfile
Upgrade swoole to v2.1.1
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index f654172d..624ea5b5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -33,7 +33,7 @@ RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.
) \
&& rm -r hiredis
-RUN wget https://github.com/swoole/swoole-src/archive/v2.1.0.tar.gz -O swoole.tar.gz \
+RUN wget https://github.com/swoole/swoole-src/archive/v2.1.1.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
&& rm swoole.tar.gz \
From e8233315af6634ee50ddfcd7848501bfc20b55fa Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Wed, 7 Mar 2018 16:02:39 +0800
Subject: [PATCH 147/643] Update README.md
Update badges
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index eb07b5a2..de475ce3 100644
--- a/README.md
+++ b/README.md
@@ -4,13 +4,13 @@
-[](https://packagist.org/packages/swoft/swoft)
+[](https://packagist.org/packages/swoft/swoft)
[](https://travis-ci.org/swoft-cloud/swoft)
[](https://packagist.org/packages/swoft/swoft)
[](https://packagist.org/packages/swoft/swoft)
[](https://packagist.org/packages/swoft/swoft)
[](https://doc.swoft.org)
-[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
+[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
# 简介
首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的 PHP-FPM,全异步非阻塞 IO 实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield, 有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
From a8a9888f5d7cd8ec3b7b2d650ea0d098dd91bbc1 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Wed, 7 Mar 2018 16:04:25 +0800
Subject: [PATCH 148/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index de475ce3..29983ce2 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
[](https://packagist.org/packages/swoft/swoft)
[](https://travis-ci.org/swoft-cloud/swoft)
[](https://packagist.org/packages/swoft/swoft)
-[](https://packagist.org/packages/swoft/swoft)
+[](https://packagist.org/packages/swoft/swoft)
[](https://packagist.org/packages/swoft/swoft)
[](https://doc.swoft.org)
[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
From cbde3965f605ac188759a2ea8c034bfecb253d74 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Wed, 7 Mar 2018 16:06:54 +0800
Subject: [PATCH 149/643] Update README.md
Update badge link
---
README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 29983ce2..2acdb627 100644
--- a/README.md
+++ b/README.md
@@ -4,11 +4,11 @@
-[](https://packagist.org/packages/swoft/swoft)
+[](https://github.com/swoft-cloud/swoft/releases)
[](https://travis-ci.org/swoft-cloud/swoft)
-[](https://packagist.org/packages/swoft/swoft)
-[](https://packagist.org/packages/swoft/swoft)
-[](https://packagist.org/packages/swoft/swoft)
+[](https://secure.php.net/)
+[](https://github.com/redis/hiredis)
+[](https://github.com/swoole/swoole-src)
[](https://doc.swoft.org)
[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
From 38edd016c186f5d483a5e2697a5f91a380f188f8 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Wed, 7 Mar 2018 17:03:32 +0800
Subject: [PATCH 150/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2acdb627..6e023498 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ QQ 交流群: 548173319
## Composer 安装
-* `composer create-project swoft/swoft swoft dev-master`
+* `composer create-project swoft/swoft swoft`
## Docker 安装
* `docker run -p 80:80 swoft/swoft`
From 6aa8361b629efab6b3c9d80d734efd132c1299a0 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Wed, 7 Mar 2018 21:42:06 +0800
Subject: [PATCH 151/643] fix typo
---
app/Controllers/MiddlewareController.php | 8 ++++----
...erSubMiddleware.php => ControllerSubMiddleware.php} | 6 +++---
...TestMiddleware.php => ControllerTestMiddleware.php} | 10 ++--------
3 files changed, 9 insertions(+), 15 deletions(-)
rename app/Middlewares/{ControlerSubMiddleware.php => ControllerSubMiddleware.php} (90%)
rename app/Middlewares/{ControlerTestMiddleware.php => ControllerTestMiddleware.php} (70%)
diff --git a/app/Controllers/MiddlewareController.php b/app/Controllers/MiddlewareController.php
index 3feb4552..a90d232d 100644
--- a/app/Controllers/MiddlewareController.php
+++ b/app/Controllers/MiddlewareController.php
@@ -9,15 +9,15 @@
use App\Middlewares\GroupTestMiddleware;
use App\Middlewares\ActionTestMiddleware;
use App\Middlewares\SubMiddleware;
-use App\Middlewares\ControlerSubMiddleware;
-use App\Middlewares\ControlerTestMiddleware;
+use App\Middlewares\ControllerSubMiddleware;
+use App\Middlewares\ControllerTestMiddleware;
/**
* @Controller("middleware")
- * @Middleware(class=ControlerTestMiddleware::class)
+ * @Middleware(class=ControllerTestMiddleware::class)
* @Middlewares({
- * @Middleware(ControlerSubMiddleware::class)
+ * @Middleware(ControllerSubMiddleware::class)
* })
*/
class MiddlewareController
diff --git a/app/Middlewares/ControlerSubMiddleware.php b/app/Middlewares/ControllerSubMiddleware.php
similarity index 90%
rename from app/Middlewares/ControlerSubMiddleware.php
rename to app/Middlewares/ControllerSubMiddleware.php
index a1ba52bb..8b7111ac 100644
--- a/app/Middlewares/ControlerSubMiddleware.php
+++ b/app/Middlewares/ControllerSubMiddleware.php
@@ -10,15 +10,15 @@
/**
* the sub middleware of controler
- *
* @Bean()
- * @uses ControlerSubMiddleware
+ *
+ * @uses ControllerSubMiddleware
* @version 2017年11月29日
* @author stelin
* @copyright Copyright 2010-2016 swoft software
* @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
-class ControlerSubMiddleware implements MiddlewareInterface
+class ControllerSubMiddleware implements MiddlewareInterface
{
/**
* @param \Psr\Http\Message\ServerRequestInterface $request
diff --git a/app/Middlewares/ControlerTestMiddleware.php b/app/Middlewares/ControllerTestMiddleware.php
similarity index 70%
rename from app/Middlewares/ControlerTestMiddleware.php
rename to app/Middlewares/ControllerTestMiddleware.php
index ab621048..4d953129 100644
--- a/app/Middlewares/ControlerTestMiddleware.php
+++ b/app/Middlewares/ControllerTestMiddleware.php
@@ -9,16 +9,10 @@
use Swoft\Http\Message\Middleware\MiddlewareInterface;
/**
- * controler middleware test
- *
+ * Controler middleware test
* @Bean()
- * @uses ControlerTestMiddleware
- * @version 2017年11月29日
- * @author stelin
- * @copyright Copyright 2010-2016 swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
-class ControlerTestMiddleware implements MiddlewareInterface
+class ControllerTestMiddleware implements MiddlewareInterface
{
/**
* @param \Psr\Http\Message\ServerRequestInterface $request
From 60c7175089f698826390cb6eb595aab074802810 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Wed, 7 Mar 2018 21:44:10 +0800
Subject: [PATCH 152/643] fix typo
---
app/Middlewares/ControllerSubMiddleware.php | 2 +-
app/Middlewares/ControllerTestMiddleware.php | 2 +-
test/Cases/MiddlewareTest.php | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/Middlewares/ControllerSubMiddleware.php b/app/Middlewares/ControllerSubMiddleware.php
index 8b7111ac..6ab866dc 100644
--- a/app/Middlewares/ControllerSubMiddleware.php
+++ b/app/Middlewares/ControllerSubMiddleware.php
@@ -29,6 +29,6 @@ class ControllerSubMiddleware implements MiddlewareInterface
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
- return $response->withAddedHeader('Controler-Sub-Middleware', 'success');
+ return $response->withAddedHeader('Controller-Sub-Middleware', 'success');
}
}
\ No newline at end of file
diff --git a/app/Middlewares/ControllerTestMiddleware.php b/app/Middlewares/ControllerTestMiddleware.php
index 4d953129..48b62bd9 100644
--- a/app/Middlewares/ControllerTestMiddleware.php
+++ b/app/Middlewares/ControllerTestMiddleware.php
@@ -23,6 +23,6 @@ class ControllerTestMiddleware implements MiddlewareInterface
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
- return $response->withAddedHeader('Controler-Test-Middleware', 'success');
+ return $response->withAddedHeader('Controller-Test-Middleware', 'success');
}
}
\ No newline at end of file
diff --git a/test/Cases/MiddlewareTest.php b/test/Cases/MiddlewareTest.php
index b5068279..6df9dc2a 100644
--- a/test/Cases/MiddlewareTest.php
+++ b/test/Cases/MiddlewareTest.php
@@ -41,7 +41,7 @@ public function action3()
{
$response = $this->request('GET', '/middleware/action3', [], parent::ACCEPT_JSON);
$response->assertExactJson(['middleware3']);
- $response->assertHeader('Controler-Test-Middleware', 'success');
- $response->assertHeader('Controler-Sub-Middleware', 'success');
+ $response->assertHeader('Controller-Test-Middleware', 'success');
+ $response->assertHeader('Controller-Sub-Middleware', 'success');
}
}
\ No newline at end of file
From f931ae4edd868cd55a64337fcf8d9c8ed3aa8069 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Wed, 7 Mar 2018 22:03:41 +0800
Subject: [PATCH 153/643] improve redis functional test, will skip the test
when no redis connection
---
test/Cases/RedisControllerTest.php | 168 ++++++++++++++++++-----------
1 file changed, 106 insertions(+), 62 deletions(-)
diff --git a/test/Cases/RedisControllerTest.php b/test/Cases/RedisControllerTest.php
index 3cfb5e41..8c3b2b7b 100644
--- a/test/Cases/RedisControllerTest.php
+++ b/test/Cases/RedisControllerTest.php
@@ -2,28 +2,56 @@
namespace Swoft\Test\Cases;
+use Swoft\Redis\Redis;
+
/**
- * @uses RedisControllerTest
- * @version 2017年11月30日
- * @author huangzhhui
- * @copyright Copyright 2010-2017 Swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
+ * Class RedisControllerTest
+ *
+ * @package Swoft\Test\Cases
*/
class RedisControllerTest extends AbstractTestCase
{
+ protected $isRedisConnected = false;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $redis = bean(Redis::class);
+ try {
+ $redis->has('test');
+ $this->isRedisConnected = true;
+ } catch (\Exception $e) {
+ // No connection or else error
+ }
+ }
+
+ /**
+ * @param \Closure $closure
+ */
+ protected function runRedisTest(\Closure $closure)
+ {
+ if ($this->isRedisConnected) {
+ $closure();
+ } else {
+ $this->markTestSkipped('No redis connection');
+ }
+ }
+
/**
* @test
* @requires extension redis
*/
public function cache()
{
- $expected = [
- true,
- 'stelin',
- ];
- $response = $this->request('GET', '/redis/testCache', [], parent::ACCEPT_JSON);
- $response->assertSuccessful()->assertJson($expected);
+ $this->runRedisTest(function () {
+ $expected = [
+ true,
+ 'stelin',
+ ];
+ $response = $this->request('GET', '/redis/testCache', [], parent::ACCEPT_JSON);
+ $response->assertSuccessful()->assertJson($expected);
+ });
}
/**
@@ -32,12 +60,14 @@ public function cache()
*/
public function redis()
{
- $expected = [
- true,
- 'stelin2',
- ];
- $response = $this->request('GET', '/redis/testRedis', [], parent::ACCEPT_JSON);
- $response->assertSuccessful()->assertJson($expected);
+ $this->runRedisTest(function () {
+ $expected = [
+ true,
+ 'stelin2',
+ ];
+ $response = $this->request('GET', '/redis/testRedis', [], parent::ACCEPT_JSON);
+ $response->assertSuccessful()->assertJson($expected);
+ });
}
/**
@@ -46,12 +76,14 @@ public function redis()
*/
public function func()
{
- $expected = [
- true,
- 'stelin3',
- ];
- $response = $this->request('GET', '/redis/testFunc', [], parent::ACCEPT_JSON);
- $response->assertSuccessful()->assertJson($expected);
+ $this->runRedisTest(function () {
+ $expected = [
+ true,
+ 'stelin3',
+ ];
+ $response = $this->request('GET', '/redis/testFunc', [], parent::ACCEPT_JSON);
+ $response->assertSuccessful()->assertJson($expected);
+ });
}
/**
@@ -60,13 +92,15 @@ public function func()
*/
public function func2()
{
- $expected = [
- true,
- 'stelin3',
- 'value3',
- ];
- $response = $this->request('GET', '/redis/testFunc2', [], parent::ACCEPT_JSON);
- $response->assertSuccessful()->assertJson($expected);
+ $this->runRedisTest(function () {
+ $expected = [
+ true,
+ 'stelin3',
+ 'value3',
+ ];
+ $response = $this->request('GET', '/redis/testFunc2', [], parent::ACCEPT_JSON);
+ $response->assertSuccessful()->assertJson($expected);
+ });
}
/**
@@ -75,12 +109,14 @@ public function func2()
*/
public function delete()
{
- $expected = [
- true,
- 1,
- ];
- $response = $this->request('GET', '/redis/testDelete', [], parent::ACCEPT_JSON);
- $response->assertSuccessful()->assertJson($expected);
+ $this->runRedisTest(function () {
+ $expected = [
+ true,
+ 1,
+ ];
+ $response = $this->request('GET', '/redis/testDelete', [], parent::ACCEPT_JSON);
+ $response->assertSuccessful()->assertJson($expected);
+ });
}
/**
@@ -89,11 +125,13 @@ public function delete()
*/
public function clear()
{
- $expected = [
- true,
- ];
- $response = $this->request('GET', '/redis/clear', [], parent::ACCEPT_JSON);
- $response->assertSuccessful()->assertJson($expected);
+ $this->runRedisTest(function () {
+ $expected = [
+ true,
+ ];
+ $response = $this->request('GET', '/redis/clear', [], parent::ACCEPT_JSON);
+ $response->assertSuccessful()->assertJson($expected);
+ });
}
/**
@@ -102,15 +140,17 @@ public function clear()
*/
public function multiple()
{
- $expected = [
- true,
- [
- 'stelin6',
- 'stelin8',
- ],
- ];
- $response = $this->request('GET', '/redis/setMultiple', [], parent::ACCEPT_JSON);
- $response->assertSuccessful()->assertJson($expected);
+ $this->runRedisTest(function () {
+ $expected = [
+ true,
+ [
+ 'stelin6',
+ 'stelin8',
+ ],
+ ];
+ $response = $this->request('GET', '/redis/setMultiple', [], parent::ACCEPT_JSON);
+ $response->assertSuccessful()->assertJson($expected);
+ });
}
/**
@@ -119,12 +159,14 @@ public function multiple()
*/
public function deleteMultiple()
{
- $expected = [
- true,
- 2,
- ];
- $response = $this->request('GET', '/redis/deleteMultiple', [], parent::ACCEPT_JSON);
- $response->assertSuccessful()->assertJson($expected);
+ $this->runRedisTest(function () {
+ $expected = [
+ true,
+ 2,
+ ];
+ $response = $this->request('GET', '/redis/deleteMultiple', [], parent::ACCEPT_JSON);
+ $response->assertSuccessful()->assertJson($expected);
+ });
}
/**
@@ -133,11 +175,13 @@ public function deleteMultiple()
*/
public function has()
{
- $expected = [
- true,
- true,
- ];
- $response = $this->request('GET', '/redis/has', [], parent::ACCEPT_JSON);
- $response->assertSuccessful()->assertJson($expected);
+ $this->runRedisTest(function () {
+ $expected = [
+ true,
+ true,
+ ];
+ $response = $this->request('GET', '/redis/has', [], parent::ACCEPT_JSON);
+ $response->assertSuccessful()->assertJson($expected);
+ });
}
}
\ No newline at end of file
From f801f97362207a65a114b1ab6c60f69179155620 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Thu, 8 Mar 2018 03:28:43 +0800
Subject: [PATCH 154/643] fixed validator unit test, cuz passing property name
to validator now, and use property name in exception message
---
test/Cases/ValidatorControllerTest.php | 100 ++++++++++++-------------
1 file changed, 50 insertions(+), 50 deletions(-)
diff --git a/test/Cases/ValidatorControllerTest.php b/test/Cases/ValidatorControllerTest.php
index c771effb..37261e17 100644
--- a/test/Cases/ValidatorControllerTest.php
+++ b/test/Cases/ValidatorControllerTest.php
@@ -7,44 +7,44 @@
*
* @uses ValidatorControllerTest
* @version 2017年12月03日
- * @author stelin
+ * @author swoft
* @copyright Copyright 2010-2016 swoft software
* @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
class ValidatorControllerTest extends AbstractTestCase
{
/**
- * @covers \App\Controllers\ValidatorController@string
+ * @covers \App\Controllers\ValidatorController::string
*/
public function testString()
{
- $response = $this->request('GET', '/validator/string/stelin', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['boy', 'girl', 'stelin']);
+ $response = $this->request('GET', '/validator/string/swoft', [], parent::ACCEPT_JSON);
+ $response->assertExactJson(['boy', 'girl', 'swoft']);
$response = $this->request('POST', '/validator/string/c', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'c is too small (minimum is 3)']);
+ $response->assertExactJson(['message' => 'Parameter name length is too short (minimum is 3)']);
- $response = $this->request('POST', '/validator/string/stelin', ['name' => 'a'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'a is too small (minimum is 3)']);
+ $response = $this->request('POST', '/validator/string/swoft', ['name' => 'a'], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'Parameter name length is too short (minimum is 3)']);
- $response = $this->request('POST', '/validator/string/stelin?name=b', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'b is too small (minimum is 3)']);
+ $response = $this->request('POST', '/validator/string/swoft?name=b', [], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'Parameter name length is too short (minimum is 3)']);
- $response = $this->request('POST', '/validator/string/stelin66666666', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'stelin66666666 is too big (maximum is 10)']);
+ $response = $this->request('POST', '/validator/string/swoft66666666', [], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'Parameter name length is too long (maximum is 10)']);
- $response = $this->request('POST', '/validator/string/stelin', ['name' => 'stelin66666666'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'stelin66666666 is too big (maximum is 10)']);
+ $response = $this->request('POST', '/validator/string/swoft', ['name' => 'swoft66666666'], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'Parameter name length is too long (maximum is 10)']);
- $response = $this->request('POST', '/validator/string/stelin?name=stelin66666666', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'stelin66666666 is too big (maximum is 10)']);
+ $response = $this->request('POST', '/validator/string/swoft?name=swoft66666666', [], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'Parameter name length is too long (maximum is 10)']);
- $response = $this->request('POST', '/validator/string/stelinPath?name=stelinGet', ['name' => 'stelinPost'], parent::ACCEPT_JSON);
- $response->assertExactJson(['stelinGet', 'stelinPost', 'stelinPath']);
+ $response = $this->request('POST', '/validator/string/swoftPath?name=swoftGet', ['name' => 'swoftPost'], parent::ACCEPT_JSON);
+ $response->assertExactJson(['swoftGet', 'swoftPost', 'swoftPath']);
}
/**
- * @covers \App\Controllers\ValidatorController@number
+ * @covers \App\Controllers\ValidatorController::number
*/
public function testNumber()
{
@@ -52,70 +52,70 @@ public function testNumber()
$response->assertExactJson([7, 8, 10]);
$response = $this->request('POST', '/validator/number/3', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '3 is too small (minimum is 5)']);
+ $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/number/6', ['id' => '-2'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '-2 is not number']);
+ $response->assertExactJson(['message' => 'Parameter id is not a number']);
$response = $this->request('POST', '/validator/number/6', ['id' => '2'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '2 is too small (minimum is 5)']);
+ $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/number/6?id=-2', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '-2 is not number']);
+ $response->assertExactJson(['message' => 'Parameter id is not a number']);
$response = $this->request('POST', '/validator/number/6?id=2', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '2 is too small (minimum is 5)']);
+ $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/number/12', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '12 is too big (maximum is 10)']);
+ $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/number/9', ['id' => '12'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '12 is too big (maximum is 10)']);
+ $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/number/9?id=12', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '12 is too big (maximum is 10)']);
+ $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/number/9?id=9', ['id' => '9'], parent::ACCEPT_JSON);
$response->assertExactJson(['9', '9', 9]);
}
/**
- * @covers \App\Controllers\ValidatorController@float
+ * @covers \App\Controllers\ValidatorController::float
*/
public function testFloat()
{
$response = $this->request('GET', '/validator/float/a', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'a is not float']);
+ $response->assertExactJson(['message' => 'Parameter id is not float type']);
$response = $this->request('GET', '/validator/float/5', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '5 is not float']);
+ $response->assertExactJson(['message' => 'Parameter id is not float type']);
$response = $this->request('POST', '/validator/float/5.0', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '5 is too small (minimum is 5.1)']);
+ $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/float/6.0', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '6 is too big (maximum is 5.9)']);
+ $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 5)']);
$response = $this->request('POST', '/validator/float/5.2', ['id' => 5], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '5 is not float']);
+ $response->assertExactJson(['message' => 'Parameter id is not float type']);
$response = $this->request('POST', '/validator/float/5.2', ['id' => '5.0'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '5 is too small (minimum is 5.1)']);
+ $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/float/5.2', ['id' => '6.0'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '6 is too big (maximum is 5.9)']);
+ $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 5)']);
$response = $this->request('POST', '/validator/float/5.2', ['id' => '5.2'], parent::ACCEPT_JSON);
$response->assertExactJson([5.6, '5.2', 5.2]);
$response = $this->request('POST', '/validator/float/5.2?id=5', [5.2], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '5 is not float']);
+ $response->assertExactJson(['message' => 'Parameter id is not float type']);
$response = $this->request('POST', '/validator/float/5.2?id=5.0', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '5 is too small (minimum is 5.1)']);
+ $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/float/5.2?id=6.0', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '6 is too big (maximum is 5.9)']);
+ $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 5)']);
$response = $this->request('POST', '/validator/float/5.2?id=5.2', ['id' => '5.2'], parent::ACCEPT_JSON);
@@ -123,7 +123,7 @@ public function testFloat()
}
/**
- * @covers \App\Controllers\ValidatorController@integer
+ * @covers \App\Controllers\ValidatorController::integer
*/
public function testInteger()
{
@@ -131,46 +131,46 @@ public function testInteger()
$response->assertExactJson([7, 8, 10]);
$response = $this->request('POST', '/validator/integer/3', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '3 is too small (minimum is 5)']);
+ $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/integer/6', ['id' => 'a'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'a is not integer']);
+ $response->assertExactJson(['message' => 'Parameter id is not integer type']);
$response = $this->request('POST', '/validator/integer/6', ['id' => '2'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '2 is too small (minimum is 5)']);
+ $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/integer/6?id=a', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'a is not integer']);
+ $response->assertExactJson(['message' => 'Parameter id is not integer type']);
$response = $this->request('POST', '/validator/integer/6?id=2', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '2 is too small (minimum is 5)']);
+ $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/integer/12', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '12 is too big (maximum is 10)']);
+ $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/integer/9', ['id' => '12'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '12 is too big (maximum is 10)']);
+ $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/integer/9?id=12', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '12 is too big (maximum is 10)']);
+ $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/integer/9?id=9', ['id' => '9'], parent::ACCEPT_JSON);
$response->assertExactJson(['9', '9', 9]);
}
/**
- * @covers \App\Controllers\ValidatorController@enum
+ * @covers \App\Controllers\ValidatorController::enum
*/
public function testEnum()
{
$response = $this->request('POST', '/validator/enum/4', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '4 is not valid enum!']);
+ $response->assertExactJson(['message' => 'Parameter name is an invalid enum value']);
$response = $this->request('POST', '/validator/enum/1?name=4', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '4 is not valid enum!']);
+ $response->assertExactJson(['message' => 'Parameter name is an invalid enum value']);
$response = $this->request('POST', '/validator/enum/1', ['name' => '4'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => '4 is not valid enum!']);
+ $response->assertExactJson(['message' => 'Parameter name is an invalid enum value']);
$response = $this->request('POST', '/validator/enum/1?name=a', ['name' => '3'], parent::ACCEPT_JSON);
$response->assertExactJson(['a', '3', '1']);
From ea62ff90f8678be149cf293630de8e96dc844d13 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Thu, 8 Mar 2018 03:29:04 +0800
Subject: [PATCH 155/643] fixed redis unit test
---
app/Controllers/RedisController.php | 24 +++++++++++++-----------
test/Cases/RedisControllerTest.php | 12 ++++++------
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/app/Controllers/RedisController.php b/app/Controllers/RedisController.php
index dc0ef1db..ee42028a 100644
--- a/app/Controllers/RedisController.php
+++ b/app/Controllers/RedisController.php
@@ -27,7 +27,7 @@ class RedisController
public function testCache()
{
- $result = $this->cache->set('name', 'stelin');
+ $result = $this->cache->set('name', 'swoft');
$name = $this->cache->get('name');
$this->redis->incr("count");
@@ -39,7 +39,7 @@ public function testCache()
public function testRedis()
{
- $result = $this->redis->set('nameRedis', 'stelin2');
+ $result = $this->redis->set('nameRedis', 'swoft2');
$name = $this->redis->get('nameRedis');
return [$result, $name];
@@ -47,7 +47,7 @@ public function testRedis()
public function testFunc()
{
- $result = cache()->set('nameFunc', 'stelin3');
+ $result = cache()->set('nameFunc', 'swoft3');
$name = cache()->get('nameFunc');
return [$result, $name];
@@ -55,7 +55,7 @@ public function testFunc()
public function testFunc2()
{
- $result = cache()->set('nameFunc2', 'stelin3');
+ $result = cache()->set('nameFunc2', 'swoft3');
$name = cache('nameFunc2');
$name2 = cache('nameFunc3', 'value3');
@@ -64,7 +64,7 @@ public function testFunc2()
public function testDelete()
{
- $result = $this->cache->set('name', 'stelin');
+ $result = $this->cache->set('name', 'swoft');
$del = $this->cache->delete('name');
return [$result, $del];
@@ -79,7 +79,7 @@ public function clear()
public function setMultiple()
{
- $result = $this->cache->setMultiple(['name6' => 'stelin6', 'name8' => 'stelin8']);
+ $result = $this->cache->setMultiple(['name6' => 'swoft6', 'name8' => 'swoft8']);
$ary = $this->cache->getMultiple(['name6', 'name8']);
return [$result, $ary];
@@ -87,7 +87,7 @@ public function setMultiple()
public function deleteMultiple()
{
- $result = $this->cache->setMultiple(['name6' => 'stelin6', 'name8' => 'stelin8']);
+ $result = $this->cache->setMultiple(['name6' => 'swoft6', 'name8' => 'swoft8']);
$ary = $this->cache->deleteMultiple(['name6', 'name8']);
return [$result, $ary];
@@ -95,7 +95,7 @@ public function deleteMultiple()
public function has()
{
- $result = $this->cache->set("name666", 'stelin666');
+ $result = $this->cache->set("name666", 'swoft666');
$ret = $this->cache->has('name666');
return [$result, $ret];
@@ -103,13 +103,15 @@ public function has()
public function testDefer()
{
- $ret1 = $this->redis->deferCall('set', ['name1', 'stelin1']);
- $ret2 = $this->redis->deferCall('set', ['name2', 'stelin2']);
+ $ret1 = $this->redis->deferCall('set', ['name1', 'swoft1']);
+ $ret2 = $this->redis->deferCall('set', ['name2', 'swoft2']);
$r1 = $ret1->getResult();
+ $r2 = 1;
$r2 = $ret2->getResult();
- $ary = $this->redis->getMultiple(['name1', 'name2']);
+ $ary = 1;
+ // $ary = $this->redis->getMultiple(['name1', 'name2']);
return [$r1, $r2, $ary];
}
diff --git a/test/Cases/RedisControllerTest.php b/test/Cases/RedisControllerTest.php
index 8c3b2b7b..27f17759 100644
--- a/test/Cases/RedisControllerTest.php
+++ b/test/Cases/RedisControllerTest.php
@@ -47,7 +47,7 @@ public function cache()
$this->runRedisTest(function () {
$expected = [
true,
- 'stelin',
+ 'swoft',
];
$response = $this->request('GET', '/redis/testCache', [], parent::ACCEPT_JSON);
$response->assertSuccessful()->assertJson($expected);
@@ -63,7 +63,7 @@ public function redis()
$this->runRedisTest(function () {
$expected = [
true,
- 'stelin2',
+ 'swoft2',
];
$response = $this->request('GET', '/redis/testRedis', [], parent::ACCEPT_JSON);
$response->assertSuccessful()->assertJson($expected);
@@ -79,7 +79,7 @@ public function func()
$this->runRedisTest(function () {
$expected = [
true,
- 'stelin3',
+ 'swoft3',
];
$response = $this->request('GET', '/redis/testFunc', [], parent::ACCEPT_JSON);
$response->assertSuccessful()->assertJson($expected);
@@ -95,7 +95,7 @@ public function func2()
$this->runRedisTest(function () {
$expected = [
true,
- 'stelin3',
+ 'swoft3',
'value3',
];
$response = $this->request('GET', '/redis/testFunc2', [], parent::ACCEPT_JSON);
@@ -144,8 +144,8 @@ public function multiple()
$expected = [
true,
[
- 'stelin6',
- 'stelin8',
+ 'name6' => 'swoft6',
+ 'name8' => 'swoft8',
],
];
$response = $this->request('GET', '/redis/setMultiple', [], parent::ACCEPT_JSON);
From 251f77703f2af7554f124ea5bc93f45fc9cdeb36 Mon Sep 17 00:00:00 2001
From: daydaygo <1252409767@qq.com>
Date: Fri, 9 Mar 2018 11:00:59 +0800
Subject: [PATCH 156/643] add http2
---
.env.example | 3 +++
config/server.php | 3 +++
2 files changed, 6 insertions(+)
diff --git a/.env.example b/.env.example
index 62291e45..478c4927 100644
--- a/.env.example
+++ b/.env.example
@@ -19,6 +19,9 @@ TCP_MODE=SWOOLE_PROCESS
TCP_TYPE=SWOOLE_SOCK_TCP
TCP_PACKAGE_MAX_LENGTH=2048
TCP_OPEN_EOF_CHECK=false
+OPEN_HTTP2_PROTOCOL=true
+SSL_CERT_FILE=/path/to/ssl_cert_file
+SSL_KEY_FILE=/path/to/ssl_key_file
# Crontab
CRONTAB_TASK_COUNT=1024
diff --git a/config/server.php b/config/server.php
index 9cd4fe82..fab1e76f 100644
--- a/config/server.php
+++ b/config/server.php
@@ -36,5 +36,8 @@
'upload_tmp_dir' => env('UPLOAD_TMP_DIR', '@runtime/uploadfiles'),
'document_root' => env('DOCUMENT_ROOT', BASE_PATH . '/public'),
'enable_static_handler' => env('ENABLE_STATIC_HANDLER', true),
+ 'open_http2_protocol' => env('OPEN_HTTP2_PROTOCOL', false),
+ 'ssl_cert_file' => env('SSL_CERT_FILE', ''),
+ 'ssl_key_file' => env('SSL_KEY_FILE', ''),
],
];
\ No newline at end of file
From c6c507369b3500f08d3e2658f8697523d12688d6 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Fri, 9 Mar 2018 12:41:48 +0800
Subject: [PATCH 157/643] Update Dockerfile
add apt-get autoremove
---
Dockerfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 624ea5b5..b67ba368 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,7 +13,8 @@ RUN apt-get update \
zip \
libz-dev \
libssl-dev \
- && apt-get clean
+ && apt-get clean \
+ && apt-get autoremove
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
From aef478371e20208705d6a552e0933b489c6bfc2a Mon Sep 17 00:00:00 2001
From: daydaygo <1252409767@qq.com>
Date: Fri, 9 Mar 2018 16:25:25 +0800
Subject: [PATCH 158/643] add http2
---
.env.example | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.env.example b/.env.example
index 478c4927..9bdaf103 100644
--- a/.env.example
+++ b/.env.example
@@ -19,9 +19,6 @@ TCP_MODE=SWOOLE_PROCESS
TCP_TYPE=SWOOLE_SOCK_TCP
TCP_PACKAGE_MAX_LENGTH=2048
TCP_OPEN_EOF_CHECK=false
-OPEN_HTTP2_PROTOCOL=true
-SSL_CERT_FILE=/path/to/ssl_cert_file
-SSL_KEY_FILE=/path/to/ssl_key_file
# Crontab
CRONTAB_TASK_COUNT=1024
@@ -35,6 +32,9 @@ DISPATCH_MODE=2
LOG_FILE=@runtime/logs/swoole.log
TASK_WORKER_NUM=1
PACKAGE_MAX_LENGTH=2048
+OPEN_HTTP2_PROTOCOL=false
+SSL_CERT_FILE=/path/to/ssl_cert_file
+SSL_KEY_FILE=/path/to/ssl_key_file
# Database Master nodes
DB_NAME=dbMaster
From 17aa6c71c1e1a8e9b89dd6514fc24fffffd324b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Fri, 9 Mar 2018 19:35:36 +0800
Subject: [PATCH 159/643] add Runtime environment question
---
.github/ISSUE_TEMPLATE.md | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 0cce5afa..be97a863 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -1,10 +1,11 @@
-| Q | A
-| ---------------- | -----
-| Bug report? | yes/no
-| Feature request? | yes/no
-| Swoft version | x.y.z
-| Swoole version | x.y.z (by `php --ri swoole`)
-| PHP version | x.y.z (by `php -v`)
+| Q | A
+| ------------------- | -----
+| Bug report? | yes/no
+| Feature request? | yes/no
+| Swoft version | x.y.z
+| Swoole version | x.y.z (by `php --ri swoole`)
+| PHP version | x.y.z (by `php -v`)
+| Runtime environment | Win10/Mac/CentOS 7/Ubuntu/Docker etc.
**Details**
From 0bfc87697bcf095378262c2a3c95481bdc1f4e6a Mon Sep 17 00:00:00 2001
From: kcloze <460309735@qq.com>
Date: Fri, 9 Mar 2018 22:47:43 +0800
Subject: [PATCH 160/643] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A?=
=?UTF-8?q?=E4=B9=89=E5=AE=B9=E5=99=A8=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docker-compose.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/docker-compose.yml b/docker-compose.yml
index c44f15f0..bbbaea52 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,7 @@
version: '2'
services:
swoft:
+ container_name: swoft
image: swoft/swoft:latest
ports:
- "80:80"
From 55a567471341a7b27de7076e963d5df6a2987530 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Sat, 10 Mar 2018 03:35:29 +0800
Subject: [PATCH 161/643] Update default configuration
---
.env.example | 4 ++--
config/beans/base.php | 2 +-
config/beans/log.php | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/.env.example b/.env.example
index 62291e45..c4713f06 100644
--- a/.env.example
+++ b/.env.example
@@ -24,9 +24,9 @@ TCP_OPEN_EOF_CHECK=false
CRONTAB_TASK_COUNT=1024
CRONTAB_TASK_QUEUE=2048
-# Settings
+# Swoole Settings
WORKER_NUM=1
-MAX_REQUEST=10000
+MAX_REQUEST=100000
DAEMONIZE=0
DISPATCH_MODE=2
LOG_FILE=@runtime/logs/swoole.log
diff --git a/config/beans/base.php b/config/beans/base.php
index d4110c58..4e277e3b 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -4,7 +4,7 @@
'serverDispatcher' => [
'middlewares' => [
\Swoft\View\Middleware\ViewMiddleware::class,
- \Swoft\Session\Middleware\SessionMiddleware::class,
+ //\Swoft\Session\Middleware\SessionMiddleware::class,
]
],
'httpRouter' => [
diff --git a/config/beans/log.php b/config/beans/log.php
index d871d96f..6385f0a9 100644
--- a/config/beans/log.php
+++ b/config/beans/log.php
@@ -22,8 +22,8 @@
],
'logger' => [
'name' => APP_NAME,
- 'flushInterval' => 100,
- 'flushRequest' => true,
+ 'flushInterval' => 100000,
+ 'flushRequest' => false,
'handlers' => [
'${noticeHandler}',
'${applicationHandler}',
From 8c5cad409e60a8527177879514ec9e16cafd0b11 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Sat, 10 Mar 2018 03:42:50 +0800
Subject: [PATCH 162/643] Update README.md
Fix badge link
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 6e023498..e9d5221e 100644
--- a/README.md
+++ b/README.md
@@ -7,8 +7,8 @@
[](https://github.com/swoft-cloud/swoft/releases)
[](https://travis-ci.org/swoft-cloud/swoft)
[](https://secure.php.net/)
-[](https://github.com/redis/hiredis)
-[](https://github.com/swoole/swoole-src)
+[](https://github.com/swoole/swoole-src)
+[](https://github.com/redis/hiredis)
[](https://doc.swoft.org)
[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
From ce0cbd6aafd6175de6f756af2feb346f17e72d83 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sat, 10 Mar 2018 22:25:04 +0800
Subject: [PATCH 163/643] modify demo
---
app/Exception/SwoftExceptionHandler.php | 2 ++
app/Tasks/SyncTask.php | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/Exception/SwoftExceptionHandler.php b/app/Exception/SwoftExceptionHandler.php
index 31cb08fd..6001e4f9 100644
--- a/app/Exception/SwoftExceptionHandler.php
+++ b/app/Exception/SwoftExceptionHandler.php
@@ -2,6 +2,7 @@
namespace App\Exception;
+use Swoft\App;
use Swoft\Bean\Annotation\ExceptionHandler;
use Swoft\Bean\Annotation\Handler;
use Swoft\Exception\RuntimeException;
@@ -40,6 +41,7 @@ public function handlerException(Response $response, \Throwable $throwable)
$exception = $throwable->getMessage();
$data = ['msg' => $exception, 'file' => $file, 'line' => $line, 'code' => $code];
+ App::error(json_encode($data));
return $response->json($data);
}
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index f9ca1554..f271e5ac 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -87,9 +87,9 @@ public function cache()
* @return array
*/
public function mysql(){
- $result = User::findById(425)->getResult();
+ $result = User::findById(720)->getResult();
- $query = User::findById(426);
+ $query = User::findById(720);
/* @var User $user */
$user = $query->getResult(User::class);
From dcffb81aa8bf564918262ec11c6b9a9410b9fb38 Mon Sep 17 00:00:00 2001
From: daydaygo <1252409767@qq.com>
Date: Sun, 11 Mar 2018 19:00:48 +0800
Subject: [PATCH 164/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index e9d5221e..f0c467f5 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
From 8a295e761ecb5ff5be0fb6d21c1aeda11dcfbd01 Mon Sep 17 00:00:00 2001
From: daydaygo <1252409767@qq.com>
Date: Sun, 11 Mar 2018 19:12:29 +0800
Subject: [PATCH 165/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index f0c467f5..e58220ea 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
From 7550b8482758ca39877ab3f1b077a2345f5a7eba Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sun, 11 Mar 2018 22:21:42 +0800
Subject: [PATCH 166/643] modify demo
---
.env.example | 4 +-
app/Controllers/OrmController.php | 81 ++++++++++++++++++++---------
app/Controllers/RedisController.php | 9 ++++
3 files changed, 66 insertions(+), 28 deletions(-)
diff --git a/.env.example b/.env.example
index 3451cc46..689e2f1f 100644
--- a/.env.example
+++ b/.env.example
@@ -44,9 +44,7 @@ DB_MAX_ACTIVE=10
DB_MAX_WAIT=20
DB_MAX_WAIT_TIME=3
DB_MAX_IDLE_TIME=60
-DB_MAX_WAIT_TIME=3
-DB_MAX_IDLE_TIME=60
-DB_TIMEOUT=200
+DB_TIMEOUT=2
# Database Slave nodes
DB_SLAVE_NAME=dbSlave
diff --git a/app/Controllers/OrmController.php b/app/Controllers/OrmController.php
index 6678a94c..2019d2e6 100644
--- a/app/Controllers/OrmController.php
+++ b/app/Controllers/OrmController.php
@@ -4,6 +4,7 @@
use App\Models\Entity\Count;
use App\Models\Entity\User;
+use Swoft\Db\Pool;
use Swoft\Http\Server\Bean\Annotation\Controller;
use Swoft\Db\EntityManager;
use Swoft\Db\QueryBuilder;
@@ -209,9 +210,9 @@ public function find()
*/
public function arFindId()
{
- $result = User::findById(720)->getResult();
+ $result = User::findById(4212)->getResult();
- $query = User::findById(720);
+ $query = User::findById(4212);
/* @var User $user */
$user = $query->getResult(User::class);
@@ -345,32 +346,62 @@ public function arCon()
return [$result1, $result2];
}
-
public function sql()
{
- $params = [
- ['uid', 433],
- ['uid2', 434],
- ['uid3', 431, Types::INT],
- ];
- $em = EntityManager::create();
-// $querySql = "SELECT * FROM user AS u LEFT JOIN count AS c ON u.id=c.uid WHERE u.id IN (:uid, :uid1, :uid3) ORDER BY u.id DESC LIMIT 2";
-// $query = $em->createQuery($querySql);
-// $query->setParameter('uid', 433);
-// $query->setParameter('uid2', 434);
-// $query->setParameter('uid3', 431);
-// $query->setParameters($params);
-
- $querySql = 'SELECT * FROM user AS u LEFT JOIN count AS c ON u.id=c.uid WHERE u.id IN (?, ?, ?) ORDER BY u.id DESC LIMIT 2';
- $query = $em->createQuery($querySql);
- $query->setParameter(1, 433);
- $query->setParameter(2, 434);
- $query->setParameter(3, 431);
-
- $result = $query->execute();
- $sql = $query->getSql();
+ $ids = [4212, 4213];
+ $poolId = Pool::MASTER;
+
+ $em = EntityManager::create($poolId);
+ $result = $em->createQuery('select * from user where id in(?, ?) and name = ? order by id desc limit 2')
+ ->setParameter(0, $ids[0])
+ ->setParameter(1, $ids[1])
+ ->setParameter(2, 'stelin')
+ ->execute()->getResult();
$em->close();
- return [$result, $sql];
+ $em = EntityManager::create($poolId);
+ $result2 = $em->createQuery('select * from user where id in(?, ?) and name = ? order by id desc limit 2')
+ ->setParameter(0, $ids[0])
+ ->setParameter(1, $ids[1])
+ ->setParameter(2, 'stelin', Types::STRING)
+ ->execute()->getResult();
+ $em->close();
+
+ $em = EntityManager::create($poolId);
+ $result3 = $em->createQuery('select * from user where id in(?, ?) and name = ? order by id desc limit 2')
+ ->setParameters([$ids[0], $ids[1], 'stelin'])
+ ->execute()->getResult();
+ $em->close();
+
+ $em = EntityManager::create($poolId);
+ $result4 = $em->createQuery('select * from user where id in(:id1, :id2) and name = :name order by id desc limit 2')
+ ->setParameter(':id1', $ids[0])
+ ->setParameter('id2', $ids[1])
+ ->setParameter('name', 'stelin')
+ ->execute()->getResult();
+ $em->close();
+
+ $em = EntityManager::create($poolId);
+ $result5 = $em->createQuery('select * from user where id in(:id1, :id2) and name = :name order by id desc limit 2')
+ ->setParameters([
+ 'id1' => $ids[0],
+ ':id2' => $ids[1],
+ 'name' => 'stelin'
+ ])
+ ->execute()->getResult();
+ $em->close();
+
+
+ $em = EntityManager::create($poolId);
+ $result6 = $em->createQuery('select * from user where id in(:id1, :id2) and name = :name order by id desc limit 2')
+ ->setParameters([
+ ['id1', $ids[0]],
+ [':id2', $ids[1], Types::INT],
+ ['name', 'stelin', Types::STRING],
+ ])
+ ->execute()->getResult();
+ $em->close();
+
+ return [\count($result)];
}
}
\ No newline at end of file
diff --git a/app/Controllers/RedisController.php b/app/Controllers/RedisController.php
index ee42028a..8dbca636 100644
--- a/app/Controllers/RedisController.php
+++ b/app/Controllers/RedisController.php
@@ -3,6 +3,7 @@
namespace App\Controllers;
+use App\Models\Entity\User;
use Swoft\Bean\Annotation\Inject;
use Swoft\Cache\Cache;
use Swoft\Http\Server\Bean\Annotation\Controller;
@@ -45,6 +46,14 @@ public function testRedis()
return [$result, $name];
}
+ public function ab()
+ {
+ $result1 = User::query()->select('*')->where('id', '720')->limit(1)->execute()->getResult();
+ $result2 = $this->redis->set('test1', 1);
+
+ return [$result1, $result2];
+ }
+
public function testFunc()
{
$result = cache()->set('nameFunc', 'swoft3');
From 8d6bc50387a620873410edd4b81cf3e1ac10e01d Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Mon, 12 Mar 2018 00:58:15 +0800
Subject: [PATCH 167/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index e58220ea..4cf3d59b 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
# 简介
-首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的 PHP-FPM,全异步非阻塞 IO 实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield, 有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
+首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈组件化框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的 PHP-FPM,全异步非阻塞 IO 实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield, 有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
- 基于 Swoole 扩展
- 内置协程网络服务器
From 116697ee46b3eecefef29a6c43fcce508a0e38d6 Mon Sep 17 00:00:00 2001
From: lixiaopei
Date: Mon, 12 Mar 2018 15:36:45 +0800
Subject: [PATCH 168/643] =?UTF-8?q?=E5=A4=9A=E6=A8=A1=E5=9D=97=E7=9B=AE?=
=?UTF-8?q?=E5=BD=95=E7=A4=BA=E8=8C=83=EF=BC=8C=E8=A7=84=E8=8C=83php-cs-fi?=
=?UTF-8?q?xer=E6=A8=A1=E6=9D=BF=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.php_cs | 6 +
app/Controllers/Admin/DemoController.php | 190 +++++++++++++++++++++++
app/Controllers/Api/RestController.php | 113 ++++++++++++++
3 files changed, 309 insertions(+)
create mode 100644 app/Controllers/Admin/DemoController.php
create mode 100644 app/Controllers/Api/RestController.php
diff --git a/.php_cs b/.php_cs
index eaaf7963..10ebe9ed 100644
--- a/.php_cs
+++ b/.php_cs
@@ -8,6 +8,12 @@ file that was distributed with this source code.
EOF;
return PhpCsFixer\Config::create()
+ ->setRiskyAllowed(true)
+ ->setRules([
+ 'header_comment' => ['header' => $header],
+
+ ])
+
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
diff --git a/app/Controllers/Admin/DemoController.php b/app/Controllers/Admin/DemoController.php
new file mode 100644
index 00000000..78ce8716
--- /dev/null
+++ b/app/Controllers/Admin/DemoController.php
@@ -0,0 +1,190 @@
+query();
+ // 获取name参数默认值defaultName
+ $getName = $request->query('name', 'defaultName');
+ // 获取所有POST参数
+ $post = $request->post();
+ // 获取name参数默认值defaultName
+ $postName = $request->post('name', 'defaultName');
+ // 获取所有参,包括GET或POST
+ $inputs = $request->input();
+ // 获取name参数默认值defaultName
+ $inputName = $request->input('name', 'defaultName');
+
+ return compact('get', 'getName', 'post', 'postName', 'inputs', 'inputName');
+ }
+
+ /**
+ * 定义一个route,支持get,以"/"开头的定义,直接是根路径,处理uri=/index2.
+ *
+ * @RequestMapping(route="/index2", method=RequestMethod::GET)
+ */
+ public function index2()
+ {
+ Coroutine::create(function () {
+ App::trace('this is child trace' . Coroutine::id());
+ Coroutine::create(function () {
+ App::trace('this is child child trace' . Coroutine::id());
+ });
+ });
+
+ return 'success';
+ }
+
+ /**
+ * 没有使用注解,自动解析注入,默认支持get和post.
+ */
+ public function task()
+ {
+ $result = Task::deliver('test', 'corTask', ['params1', 'params2'], Task::TYPE_CO);
+ $mysql = Task::deliver('test', 'testMysql', [], Task::TYPE_CO);
+ $http = Task::deliver('test', 'testHttp', [], Task::TYPE_CO, 20);
+ $rpc = Task::deliver('test', 'testRpc', [], Task::TYPE_CO, 5);
+ $result1 = Task::deliver('test', 'asyncTask', [], Task::TYPE_ASYNC);
+
+ return [$rpc, $http, $mysql, $result, $result1];
+ }
+
+ public function index6()
+ {
+ throw new Exception('AAAA');
+ // $a = $b;
+ $A = new AAA();
+
+ return ['data6'];
+ }
+
+ /**
+ * 子协程测试.
+ */
+ public function cor()
+ {
+ // 创建子协程
+ Coroutine::create(function () {
+ App::error('child cor error msg');
+ App::trace('child cor error msg');
+ });
+
+ // 当前协程id
+ $cid = Coroutine::id();
+
+ // 当前运行上下文ID, 协程环境中,顶层协程ID; 任务中,当前任务taskid; 自定义进程中,当前进程ID(pid)
+ $tid = Coroutine::tid();
+
+ return [$cid, $tid];
+ }
+
+ /**
+ * 国际化测试.
+ */
+ public function i18n()
+ {
+ $data[] = translate('title', [], 'zh');
+ $data[] = translate('title', [], 'en');
+ $data[] = translate('msg.body', ['stelin', 999], 'en');
+ $data[] = translate('msg.body', ['stelin', 666], 'en');
+
+ return $data;
+ }
+
+ /**
+ * 视图渲染demo - 没有使用布局文件.
+ *
+ * @RequestMapping()
+ * @View(template="demo/view")
+ */
+ public function view()
+ {
+ $data = [
+ 'name' => 'Swoft',
+ 'repo' => 'https://github.com/swoft-cloud/swoft',
+ 'doc' => 'https://doc.swoft.org/',
+ 'doc1' => 'https://swoft-cloud.github.io/swoft-doc/',
+ 'method' => __METHOD__,
+ ];
+
+ return $data;
+ }
+
+ /**
+ * 视图渲染demo - 使用布局文件.
+ *
+ * @RequestMapping()
+ * @View(template="demo/content", layout="layouts/default.php")
+ */
+ public function layout()
+ {
+ $layout = 'layouts/default.php';
+ $data = [
+ 'name' => 'Swoft',
+ 'repo' => 'https://github.com/swoft-cloud/swoft',
+ 'doc' => 'https://doc.swoft.org/',
+ 'doc1' => 'https://swoft-cloud.github.io/swoft-doc/',
+ 'method' => __METHOD__,
+ 'layoutFile' => $layout,
+ ];
+
+ return $data;
+ }
+}
diff --git a/app/Controllers/Api/RestController.php b/app/Controllers/Api/RestController.php
new file mode 100644
index 00000000..55ab7830
--- /dev/null
+++ b/app/Controllers/Api/RestController.php
@@ -0,0 +1,113 @@
+input('name');
+
+ $bodyParams = $request->getBodyParams();
+ $bodyParams = empty($bodyParams) ? ['create', $name] : $bodyParams;
+
+ return $bodyParams;
+ }
+
+ /**
+ * 查询一个用户信息
+ * 地址:/api/user/6.
+ *
+ * @RequestMapping(route="{uid}", method={RequestMethod::GET})
+ *
+ * @param int $uid
+ *
+ * @return array
+ */
+ public function getUser(int $uid)
+ {
+ return ['getUser', $uid];
+ }
+
+ /**
+ * 查询用户的书籍信息
+ * 地址:/api/user/6/book/8.
+ *
+ * @RequestMapping(route="{userId}/book/{bookId}", method={RequestMethod::GET})
+ *
+ * @param int $userId
+ * @param string $bookId
+ *
+ * @return array
+ */
+ public function getBookFromUser(int $userId, string $bookId)
+ {
+ return ['bookFromUser', $userId, $bookId];
+ }
+
+ /**
+ * 删除一个用户信息
+ * 地址:/api/user/6.
+ *
+ * @RequestMapping(route="{uid}", method={RequestMethod::DELETE})
+ *
+ * @param int $uid
+ *
+ * @return array
+ */
+ public function deleteUser(int $uid)
+ {
+ return ['delete', $uid];
+ }
+
+ /**
+ * 更新一个用户信息
+ * 地址:/api/user/6.
+ *
+ * @RequestMapping(route="{uid}", method={RequestMethod::PUT, RequestMethod::PATCH})
+ *
+ * @param int $uid
+ * @param Request $request
+ *
+ * @return array
+ */
+ public function updateUser(Request $request, int $uid)
+ {
+ $body = $request->getBodyParams();
+ $body['update'] = 'update';
+ $body['uid'] = $uid;
+
+ return $body;
+ }
+}
From 7294b6cab72e7516eb1f0e3fd39198be65c5e2bc Mon Sep 17 00:00:00 2001
From: lixiaopei
Date: Mon, 12 Mar 2018 15:44:11 +0800
Subject: [PATCH 169/643] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.php_cs | 1 +
app/Boot/MyProcess.php | 7 +++++++
app/Breaker/UserBreaker.php | 7 +++++++
app/Commands/TestCommand.php | 7 +++++++
app/Controllers/Admin/DemoController.php | 7 +++++++
app/Controllers/Api/RestController.php | 7 +++++++
app/Controllers/DemoController.php | 7 +++++++
app/Controllers/ExceptionController.php | 7 +++++++
app/Controllers/HttpClientController.php | 7 +++++++
app/Controllers/IndexController.php | 7 +++++++
app/Controllers/MiddlewareController.php | 7 +++++++
app/Controllers/OrmController.php | 7 +++++++
app/Controllers/Psr7Controller.php | 7 +++++++
app/Controllers/RedisController.php | 7 +++++++
app/Controllers/RestController.php | 7 +++++++
app/Controllers/RouteController.php | 7 +++++++
app/Controllers/RpcController.php | 7 +++++++
app/Controllers/SessionController.php | 7 +++++++
app/Controllers/TaskController.php | 7 +++++++
app/Controllers/ValidatorController.php | 7 +++++++
app/Exception/SwoftExceptionHandler.php | 7 +++++++
app/Fallback/DemoServiceFallback.php | 7 +++++++
app/Lib/DemoInterface.php | 7 +++++++
app/Lib/MdDemoInterface.php | 7 +++++++
app/Listener/TaskFinish.php | 7 +++++++
app/Middlewares/ActionTestMiddleware.php | 7 +++++++
app/Middlewares/ControllerSubMiddleware.php | 7 +++++++
app/Middlewares/ControllerTestMiddleware.php | 7 +++++++
app/Middlewares/GroupTestMiddleware.php | 7 +++++++
app/Middlewares/ServiceMiddleware.php | 7 +++++++
app/Middlewares/ServiceSubMiddleware.php | 7 +++++++
app/Middlewares/SubMiddleware.php | 7 +++++++
app/Middlewares/SubMiddlewares.php | 7 +++++++
app/Models/Dao/UserDao.php | 7 +++++++
app/Models/Dao/UserExtDao.php | 7 +++++++
app/Models/Data/UserData.php | 7 +++++++
app/Models/Data/UserExtData.php | 7 +++++++
app/Models/Entity/Count.php | 7 +++++++
app/Models/Entity/User.php | 7 +++++++
app/Models/Logic/IndexLogic.php | 7 +++++++
app/Models/Logic/UserLogic.php | 7 +++++++
app/Pool/Config/UserPoolConfig.php | 7 +++++++
app/Pool/UserServicePool.php | 7 +++++++
app/Process/MyProcess.php | 7 +++++++
app/Services/DemoService.php | 7 +++++++
app/Services/DemoServiceV2.php | 7 +++++++
app/Services/MiddlewareService.php | 7 +++++++
app/Swoft.php | 9 ++++++---
app/Tasks/SyncTask.php | 7 +++++++
bin/bootstrap.php | 8 ++++++++
config/beans/base.php | 7 +++++++
config/beans/console.php | 8 ++++++++
config/beans/log.php | 8 ++++++++
config/beans/service.php | 8 ++++++++
config/define.php | 8 +++++++-
config/properties/app.php | 8 ++++++++
config/properties/breaker.php | 8 ++++++++
config/properties/cache.php | 8 ++++++++
config/properties/db.php | 8 ++++++++
config/properties/provider.php | 8 ++++++++
config/properties/service.php | 8 ++++++++
config/server.php | 8 ++++++++
resources/languages/en/default.php | 8 ++++++++
resources/languages/en/msg.php | 8 ++++++++
resources/languages/zh/default.php | 8 ++++++++
resources/languages/zh/msg.php | 8 ++++++++
test/Cases/AbstractTestCase.php | 7 +++++++
test/Cases/DemoControllerTest.php | 7 +++++++
test/Cases/IndexControllerTest.php | 7 +++++++
test/Cases/MiddlewareTest.php | 7 +++++++
test/Cases/RedisControllerTest.php | 7 +++++++
test/Cases/RestTest.php | 7 +++++++
test/Cases/RouteTest.php | 7 +++++++
test/Cases/ValidatorControllerTest.php | 7 +++++++
test/bootstrap.php | 8 ++++++++
75 files changed, 534 insertions(+), 4 deletions(-)
diff --git a/.php_cs b/.php_cs
index 10ebe9ed..bb32d9d4 100644
--- a/.php_cs
+++ b/.php_cs
@@ -11,6 +11,7 @@ return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'header_comment' => ['header' => $header],
+ 'array_syntax' => ['syntax' => 'short'],
])
diff --git a/app/Boot/MyProcess.php b/app/Boot/MyProcess.php
index 6398c328..7391565f 100644
--- a/app/Boot/MyProcess.php
+++ b/app/Boot/MyProcess.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Boot;
use Swoft\App;
diff --git a/app/Breaker/UserBreaker.php b/app/Breaker/UserBreaker.php
index 00830b9e..9ff2114e 100644
--- a/app/Breaker/UserBreaker.php
+++ b/app/Breaker/UserBreaker.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Breaker;
use Swoft\Sg\Bean\Annotation\Breaker;
diff --git a/app/Commands/TestCommand.php b/app/Commands/TestCommand.php
index 3e18ea27..9b39dc24 100644
--- a/app/Commands/TestCommand.php
+++ b/app/Commands/TestCommand.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Commands;
use App\Models\Logic\UserLogic;
diff --git a/app/Controllers/Admin/DemoController.php b/app/Controllers/Admin/DemoController.php
index 78ce8716..6680d243 100644
--- a/app/Controllers/Admin/DemoController.php
+++ b/app/Controllers/Admin/DemoController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers\Admin;
use App\Models\Logic\IndexLogic;
diff --git a/app/Controllers/Api/RestController.php b/app/Controllers/Api/RestController.php
index 55ab7830..5ae8bac0 100644
--- a/app/Controllers/Api/RestController.php
+++ b/app/Controllers/Api/RestController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers\Api;
use Swoft\Http\Message\Server\Request;
diff --git a/app/Controllers/DemoController.php b/app/Controllers/DemoController.php
index aa86adc0..7af84059 100644
--- a/app/Controllers/DemoController.php
+++ b/app/Controllers/DemoController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use App\Models\Logic\IndexLogic;
diff --git a/app/Controllers/ExceptionController.php b/app/Controllers/ExceptionController.php
index 263bdcbf..3cb05d00 100644
--- a/app/Controllers/ExceptionController.php
+++ b/app/Controllers/ExceptionController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Swoft\Exception\BadMethodCallException;
diff --git a/app/Controllers/HttpClientController.php b/app/Controllers/HttpClientController.php
index 0c7fcc17..07c3df16 100644
--- a/app/Controllers/HttpClientController.php
+++ b/app/Controllers/HttpClientController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Swoft\HttpClient\Client;
diff --git a/app/Controllers/IndexController.php b/app/Controllers/IndexController.php
index f3e404d0..880b3683 100644
--- a/app/Controllers/IndexController.php
+++ b/app/Controllers/IndexController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Swoft\Http\Server\Bean\Annotation\Controller;
diff --git a/app/Controllers/MiddlewareController.php b/app/Controllers/MiddlewareController.php
index a90d232d..64f09f69 100644
--- a/app/Controllers/MiddlewareController.php
+++ b/app/Controllers/MiddlewareController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Swoft\Http\Server\Bean\Annotation\Controller;
diff --git a/app/Controllers/OrmController.php b/app/Controllers/OrmController.php
index 6678a94c..82ac7e7e 100644
--- a/app/Controllers/OrmController.php
+++ b/app/Controllers/OrmController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use App\Models\Entity\Count;
diff --git a/app/Controllers/Psr7Controller.php b/app/Controllers/Psr7Controller.php
index 121fb4ff..48fa082d 100644
--- a/app/Controllers/Psr7Controller.php
+++ b/app/Controllers/Psr7Controller.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Psr\Http\Message\UploadedFileInterface;
diff --git a/app/Controllers/RedisController.php b/app/Controllers/RedisController.php
index ee42028a..482f08fe 100644
--- a/app/Controllers/RedisController.php
+++ b/app/Controllers/RedisController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
diff --git a/app/Controllers/RestController.php b/app/Controllers/RestController.php
index 3f9a5fc8..e039165b 100644
--- a/app/Controllers/RestController.php
+++ b/app/Controllers/RestController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Swoft\Http\Server\Bean\Annotation\Controller;
diff --git a/app/Controllers/RouteController.php b/app/Controllers/RouteController.php
index 5ff7f1da..4b47edaf 100644
--- a/app/Controllers/RouteController.php
+++ b/app/Controllers/RouteController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Swoft\Http\Server\Bean\Annotation\Controller;
diff --git a/app/Controllers/RpcController.php b/app/Controllers/RpcController.php
index 7bee9f4e..19ce5dcc 100644
--- a/app/Controllers/RpcController.php
+++ b/app/Controllers/RpcController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use App\Lib\DemoInterface;
diff --git a/app/Controllers/SessionController.php b/app/Controllers/SessionController.php
index 64d0ebfc..e3c8613f 100644
--- a/app/Controllers/SessionController.php
+++ b/app/Controllers/SessionController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Swoft\Http\Message\Server\Request;
diff --git a/app/Controllers/TaskController.php b/app/Controllers/TaskController.php
index ba69ef06..2c27eab8 100644
--- a/app/Controllers/TaskController.php
+++ b/app/Controllers/TaskController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Swoft\Http\Server\Bean\Annotation\Controller;
diff --git a/app/Controllers/ValidatorController.php b/app/Controllers/ValidatorController.php
index 8c52bb50..a9dc29ae 100644
--- a/app/Controllers/ValidatorController.php
+++ b/app/Controllers/ValidatorController.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Controllers;
use Swoft\Http\Server\Bean\Annotation\Controller;
diff --git a/app/Exception/SwoftExceptionHandler.php b/app/Exception/SwoftExceptionHandler.php
index 31cb08fd..855d8611 100644
--- a/app/Exception/SwoftExceptionHandler.php
+++ b/app/Exception/SwoftExceptionHandler.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Exception;
use Swoft\Bean\Annotation\ExceptionHandler;
diff --git a/app/Fallback/DemoServiceFallback.php b/app/Fallback/DemoServiceFallback.php
index 5ba02d3e..fa9db9fe 100644
--- a/app/Fallback/DemoServiceFallback.php
+++ b/app/Fallback/DemoServiceFallback.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Fallback;
use App\Lib\DemoInterface;
diff --git a/app/Lib/DemoInterface.php b/app/Lib/DemoInterface.php
index 1c7bcaf9..53fc3139 100644
--- a/app/Lib/DemoInterface.php
+++ b/app/Lib/DemoInterface.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Lib;
use Swoft\Core\ResultInterface;
diff --git a/app/Lib/MdDemoInterface.php b/app/Lib/MdDemoInterface.php
index 59a6d69a..81288c55 100644
--- a/app/Lib/MdDemoInterface.php
+++ b/app/Lib/MdDemoInterface.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Lib;
/**
diff --git a/app/Listener/TaskFinish.php b/app/Listener/TaskFinish.php
index dc57e6ad..8f71d9c1 100644
--- a/app/Listener/TaskFinish.php
+++ b/app/Listener/TaskFinish.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Listener;
use Swoft\Bean\Annotation\Listener;
diff --git a/app/Middlewares/ActionTestMiddleware.php b/app/Middlewares/ActionTestMiddleware.php
index 07c8f50d..780753d4 100644
--- a/app/Middlewares/ActionTestMiddleware.php
+++ b/app/Middlewares/ActionTestMiddleware.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Middlewares;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/app/Middlewares/ControllerSubMiddleware.php b/app/Middlewares/ControllerSubMiddleware.php
index 6ab866dc..382ea7b8 100644
--- a/app/Middlewares/ControllerSubMiddleware.php
+++ b/app/Middlewares/ControllerSubMiddleware.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Middlewares;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/app/Middlewares/ControllerTestMiddleware.php b/app/Middlewares/ControllerTestMiddleware.php
index 48b62bd9..10debae1 100644
--- a/app/Middlewares/ControllerTestMiddleware.php
+++ b/app/Middlewares/ControllerTestMiddleware.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Middlewares;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/app/Middlewares/GroupTestMiddleware.php b/app/Middlewares/GroupTestMiddleware.php
index 0304134a..2a080897 100644
--- a/app/Middlewares/GroupTestMiddleware.php
+++ b/app/Middlewares/GroupTestMiddleware.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Middlewares;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/app/Middlewares/ServiceMiddleware.php b/app/Middlewares/ServiceMiddleware.php
index ef748393..0ede6794 100644
--- a/app/Middlewares/ServiceMiddleware.php
+++ b/app/Middlewares/ServiceMiddleware.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Middlewares;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/app/Middlewares/ServiceSubMiddleware.php b/app/Middlewares/ServiceSubMiddleware.php
index 12c8c347..8b4c199b 100644
--- a/app/Middlewares/ServiceSubMiddleware.php
+++ b/app/Middlewares/ServiceSubMiddleware.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Middlewares;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/app/Middlewares/SubMiddleware.php b/app/Middlewares/SubMiddleware.php
index 43bf0d4d..a4259bb5 100644
--- a/app/Middlewares/SubMiddleware.php
+++ b/app/Middlewares/SubMiddleware.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Middlewares;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/app/Middlewares/SubMiddlewares.php b/app/Middlewares/SubMiddlewares.php
index ecd9b42e..99495b82 100644
--- a/app/Middlewares/SubMiddlewares.php
+++ b/app/Middlewares/SubMiddlewares.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Middlewares;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/app/Models/Dao/UserDao.php b/app/Models/Dao/UserDao.php
index 54d75fd0..950d227c 100644
--- a/app/Models/Dao/UserDao.php
+++ b/app/Models/Dao/UserDao.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Models\Dao;
use Swoft\Bean\Annotation\Bean;
diff --git a/app/Models/Dao/UserExtDao.php b/app/Models/Dao/UserExtDao.php
index ae1cda44..e79027b0 100644
--- a/app/Models/Dao/UserExtDao.php
+++ b/app/Models/Dao/UserExtDao.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Models\Dao;
use Swoft\Bean\Annotation\Bean;
diff --git a/app/Models/Data/UserData.php b/app/Models/Data/UserData.php
index f6c6c256..55c854f3 100644
--- a/app/Models/Data/UserData.php
+++ b/app/Models/Data/UserData.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Models\Data;
use App\Models\Dao\UserDao;
diff --git a/app/Models/Data/UserExtData.php b/app/Models/Data/UserExtData.php
index eb7e1840..fb0e5e0b 100644
--- a/app/Models/Data/UserExtData.php
+++ b/app/Models/Data/UserExtData.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Models\Data;
use App\Models\Dao\UserExtDao;
diff --git a/app/Models/Entity/Count.php b/app/Models/Entity/Count.php
index f91bac52..5ab7066f 100644
--- a/app/Models/Entity/Count.php
+++ b/app/Models/Entity/Count.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Models\Entity;
use Swoft\Db\Bean\Annotation\Column;
diff --git a/app/Models/Entity/User.php b/app/Models/Entity/User.php
index 65695418..5bb238d7 100644
--- a/app/Models/Entity/User.php
+++ b/app/Models/Entity/User.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Models\Entity;
use Swoft\Db\Bean\Annotation\Id;
diff --git a/app/Models/Logic/IndexLogic.php b/app/Models/Logic/IndexLogic.php
index 27a852eb..45d2a482 100644
--- a/app/Models/Logic/IndexLogic.php
+++ b/app/Models/Logic/IndexLogic.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Models\Logic;
use App\Models\Data\UserData;
diff --git a/app/Models/Logic/UserLogic.php b/app/Models/Logic/UserLogic.php
index f372c2d9..83ea20a9 100644
--- a/app/Models/Logic/UserLogic.php
+++ b/app/Models/Logic/UserLogic.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Models\Logic;
use Swoft\Bean\Annotation\Bean;
diff --git a/app/Pool/Config/UserPoolConfig.php b/app/Pool/Config/UserPoolConfig.php
index 57723c20..740df348 100644
--- a/app/Pool/Config/UserPoolConfig.php
+++ b/app/Pool/Config/UserPoolConfig.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Pool\Config;
use Swoft\Bean\Annotation\Bean;
diff --git a/app/Pool/UserServicePool.php b/app/Pool/UserServicePool.php
index 34e5d259..82e47dfd 100644
--- a/app/Pool/UserServicePool.php
+++ b/app/Pool/UserServicePool.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Pool;
use Swoft\Bean\Annotation\Inject;
diff --git a/app/Process/MyProcess.php b/app/Process/MyProcess.php
index 4ac41553..abfd674a 100644
--- a/app/Process/MyProcess.php
+++ b/app/Process/MyProcess.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Process;
use Swoft\App;
diff --git a/app/Services/DemoService.php b/app/Services/DemoService.php
index 6cade9dd..8670f67d 100644
--- a/app/Services/DemoService.php
+++ b/app/Services/DemoService.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Services;
use App\Lib\DemoInterface;
diff --git a/app/Services/DemoServiceV2.php b/app/Services/DemoServiceV2.php
index adafa101..e5445d10 100644
--- a/app/Services/DemoServiceV2.php
+++ b/app/Services/DemoServiceV2.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Services;
use App\Lib\DemoInterface;
diff --git a/app/Services/MiddlewareService.php b/app/Services/MiddlewareService.php
index 1bf6b5d5..2fe429e5 100644
--- a/app/Services/MiddlewareService.php
+++ b/app/Services/MiddlewareService.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Services;
use App\Lib\MdDemoInterface;
diff --git a/app/Swoft.php b/app/Swoft.php
index e7cbedc3..161089ee 100644
--- a/app/Swoft.php
+++ b/app/Swoft.php
@@ -1,9 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
*/
+
class Swoft extends \Swoft\App
{
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index f9ca1554..53e8bcfe 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace App\Tasks;
use App\Lib\DemoInterface;
diff --git a/bin/bootstrap.php b/bin/bootstrap.php
index 5686b502..a49cae19 100644
--- a/bin/bootstrap.php
+++ b/bin/bootstrap.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
require_once dirname(__DIR__) . '/vendor/autoload.php';
require_once dirname(__DIR__) . '/config/define.php';
diff --git a/config/beans/base.php b/config/beans/base.php
index d4110c58..91e0bd60 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'serverDispatcher' => [
'middlewares' => [
diff --git a/config/beans/console.php b/config/beans/console.php
index 05e0b10e..d7acd21c 100644
--- a/config/beans/console.php
+++ b/config/beans/console.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
];
\ No newline at end of file
diff --git a/config/beans/log.php b/config/beans/log.php
index d871d96f..e0f51fd5 100644
--- a/config/beans/log.php
+++ b/config/beans/log.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'noticeHandler' => [
'class' => \Swoft\Log\FileHandler::class,
diff --git a/config/beans/service.php b/config/beans/service.php
index 60c0351d..cfbf3dd2 100644
--- a/config/beans/service.php
+++ b/config/beans/service.php
@@ -1,3 +1,11 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
];
\ No newline at end of file
diff --git a/config/define.php b/config/define.php
index f2cc8509..e013c2b8 100644
--- a/config/define.php
+++ b/config/define.php
@@ -1,6 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
! defined('DS') && define('DS', DIRECTORY_SEPARATOR);
// App name
! defined('APP_NAME') && define('APP_NAME', 'swoft');
diff --git a/config/properties/app.php b/config/properties/app.php
index bd48e6bd..eb41508a 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'version' => '1.0',
'autoInitBean' => true,
diff --git a/config/properties/breaker.php b/config/properties/breaker.php
index 1081a258..b9f1dd2e 100644
--- a/config/properties/breaker.php
+++ b/config/properties/breaker.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'user' => [
'failCount' => 3,
diff --git a/config/properties/cache.php b/config/properties/cache.php
index 175db1c1..d3a13877 100644
--- a/config/properties/cache.php
+++ b/config/properties/cache.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'redis' => [
'name' => 'redis',
diff --git a/config/properties/db.php b/config/properties/db.php
index 2ab37d3f..662b493d 100644
--- a/config/properties/db.php
+++ b/config/properties/db.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'master' => [
'name' => 'master',
diff --git a/config/properties/provider.php b/config/properties/provider.php
index 87951522..efbf716b 100644
--- a/config/properties/provider.php
+++ b/config/properties/provider.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'consul' => [
'address' => '',
diff --git a/config/properties/service.php b/config/properties/service.php
index e6d7df42..60b23b57 100644
--- a/config/properties/service.php
+++ b/config/properties/service.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'user' => [
'name' => 'redis',
diff --git a/config/server.php b/config/server.php
index 9cd4fe82..64af28ec 100644
--- a/config/server.php
+++ b/config/server.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'server' => [
'pfile' => env('PFILE', '/tmp/swoft.pid'),
diff --git a/resources/languages/en/default.php b/resources/languages/en/default.php
index 1018e758..ac27d49b 100644
--- a/resources/languages/en/default.php
+++ b/resources/languages/en/default.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'title' => 'en title'
];
diff --git a/resources/languages/en/msg.php b/resources/languages/en/msg.php
index 518324d8..4f09cc56 100644
--- a/resources/languages/en/msg.php
+++ b/resources/languages/en/msg.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'body' => 'this is msg [%s] %d',
];
diff --git a/resources/languages/zh/default.php b/resources/languages/zh/default.php
index 92a6491d..c0cccbae 100644
--- a/resources/languages/zh/default.php
+++ b/resources/languages/zh/default.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'title' => '中文标题'
];
diff --git a/resources/languages/zh/msg.php b/resources/languages/zh/msg.php
index a9e822aa..9a3d7bff 100644
--- a/resources/languages/zh/msg.php
+++ b/resources/languages/zh/msg.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
return [
'body' => '这是一条消息 [%s] %d',
];
diff --git a/test/Cases/AbstractTestCase.php b/test/Cases/AbstractTestCase.php
index a25a1437..670fdc60 100644
--- a/test/Cases/AbstractTestCase.php
+++ b/test/Cases/AbstractTestCase.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Swoft\Test\Cases;
use PHPUnit\Framework\TestCase;
diff --git a/test/Cases/DemoControllerTest.php b/test/Cases/DemoControllerTest.php
index bfe1aee6..c51b6c8e 100644
--- a/test/Cases/DemoControllerTest.php
+++ b/test/Cases/DemoControllerTest.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Swoft\Test\Cases;
diff --git a/test/Cases/IndexControllerTest.php b/test/Cases/IndexControllerTest.php
index 5cc5af38..03ad290f 100644
--- a/test/Cases/IndexControllerTest.php
+++ b/test/Cases/IndexControllerTest.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Swoft\Test\Cases;
use Swoft\Http\Message\Testing\Web\Response;
diff --git a/test/Cases/MiddlewareTest.php b/test/Cases/MiddlewareTest.php
index 6df9dc2a..118a8e1d 100644
--- a/test/Cases/MiddlewareTest.php
+++ b/test/Cases/MiddlewareTest.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Swoft\Test\Cases;
/**
diff --git a/test/Cases/RedisControllerTest.php b/test/Cases/RedisControllerTest.php
index 27f17759..919bfe88 100644
--- a/test/Cases/RedisControllerTest.php
+++ b/test/Cases/RedisControllerTest.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Swoft\Test\Cases;
use Swoft\Redis\Redis;
diff --git a/test/Cases/RestTest.php b/test/Cases/RestTest.php
index dfc524ec..0766d48d 100644
--- a/test/Cases/RestTest.php
+++ b/test/Cases/RestTest.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Swoft\Test\Cases;
/**
diff --git a/test/Cases/RouteTest.php b/test/Cases/RouteTest.php
index 5f2a6d92..4f91a27a 100644
--- a/test/Cases/RouteTest.php
+++ b/test/Cases/RouteTest.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Swoft\Test\Cases;
/**
diff --git a/test/Cases/ValidatorControllerTest.php b/test/Cases/ValidatorControllerTest.php
index 37261e17..09246207 100644
--- a/test/Cases/ValidatorControllerTest.php
+++ b/test/Cases/ValidatorControllerTest.php
@@ -1,5 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Swoft\Test\Cases;
/**
diff --git a/test/bootstrap.php b/test/bootstrap.php
index 74bd6200..62da917e 100644
--- a/test/bootstrap.php
+++ b/test/bootstrap.php
@@ -1,4 +1,12 @@
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
require_once dirname(__DIR__) . '/vendor/autoload.php';
require_once dirname(__DIR__) . '/config/define.php';
From 5b1e356469408ea2400d670ea4c1920ced2a0fc3 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Mon, 12 Mar 2018 17:12:17 +0800
Subject: [PATCH 170/643] Update rules of .php_cs
---
.php_cs | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/.php_cs b/.php_cs
index bb32d9d4..9ff88fcc 100644
--- a/.php_cs
+++ b/.php_cs
@@ -2,23 +2,33 @@
$header = <<<'EOF'
This file is part of Swoft.
-(c) Swoft
-For the full copyright and license information, please view the LICENSE
-file that was distributed with this source code.
+
+@link https://swoft.org
+@document https://doc.swoft.org
+@contact group@swoft.org
+@license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
EOF;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
- 'header_comment' => ['header' => $header],
- 'array_syntax' => ['syntax' => 'short'],
-
+ 'header_comment' => [
+ 'commentType' => 'PHPDoc',
+ 'header' => $header,
+ 'separate' => 'none'
+ ],
+ 'array_syntax' => [
+ 'syntax' => 'short'
+ ],
+ 'single_quote' => true,
])
-
->setFinder(
PhpCsFixer\Finder::create()
- ->exclude('vendor')
+ ->exclude('public')
+ ->exclude('resources')
+ ->exclude('config')
->exclude('runtime')
+ ->exclude('vendor')
->in(__DIR__)
)
->setUsingCache(false);
From 3074dfad113989c8b02d5b325d01ca945242472e Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Mon, 12 Mar 2018 17:12:25 +0800
Subject: [PATCH 171/643] php-cs-fixer fix
---
app/Boot/MyProcess.php | 11 ++++++-----
app/Breaker/UserBreaker.php | 11 ++++++-----
app/Commands/TestCommand.php | 11 ++++++-----
app/Controllers/Admin/DemoController.php | 11 ++++++-----
app/Controllers/Api/RestController.php | 11 ++++++-----
app/Controllers/DemoController.php | 11 ++++++-----
app/Controllers/ExceptionController.php | 19 ++++++++++---------
app/Controllers/HttpClientController.php | 11 ++++++-----
app/Controllers/IndexController.php | 13 +++++++------
app/Controllers/MiddlewareController.php | 11 ++++++-----
app/Controllers/OrmController.php | 13 +++++++------
app/Controllers/Psr7Controller.php | 11 ++++++-----
app/Controllers/RedisController.php | 17 +++++++++--------
app/Controllers/RestController.php | 13 +++++++------
app/Controllers/RouteController.php | 11 ++++++-----
app/Controllers/RpcController.php | 11 ++++++-----
app/Controllers/SessionController.php | 11 ++++++-----
app/Controllers/TaskController.php | 11 ++++++-----
app/Controllers/ValidatorController.php | 11 ++++++-----
app/Exception/SwoftExceptionHandler.php | 15 ++++++++-------
app/Fallback/DemoServiceFallback.php | 13 +++++++------
app/Lib/DemoInterface.php | 13 +++++++------
app/Lib/MdDemoInterface.php | 11 ++++++-----
app/Listener/TaskFinish.php | 13 +++++++------
app/Middlewares/ActionTestMiddleware.php | 11 ++++++-----
app/Middlewares/ControllerSubMiddleware.php | 11 ++++++-----
app/Middlewares/ControllerTestMiddleware.php | 11 ++++++-----
app/Middlewares/GroupTestMiddleware.php | 11 ++++++-----
app/Middlewares/ServiceMiddleware.php | 11 ++++++-----
app/Middlewares/ServiceSubMiddleware.php | 11 ++++++-----
app/Middlewares/SubMiddleware.php | 11 ++++++-----
app/Middlewares/SubMiddlewares.php | 11 ++++++-----
app/Models/Dao/UserDao.php | 11 ++++++-----
app/Models/Dao/UserExtDao.php | 11 ++++++-----
app/Models/Data/UserData.php | 11 ++++++-----
app/Models/Data/UserExtData.php | 11 ++++++-----
app/Models/Entity/Count.php | 11 ++++++-----
app/Models/Entity/User.php | 13 +++++++------
app/Models/Logic/IndexLogic.php | 11 ++++++-----
app/Models/Logic/UserLogic.php | 11 ++++++-----
app/Pool/Config/UserPoolConfig.php | 11 ++++++-----
app/Pool/UserServicePool.php | 11 ++++++-----
app/Process/MyProcess.php | 11 ++++++-----
app/Services/DemoService.php | 13 +++++++------
app/Services/DemoServiceV2.php | 13 +++++++------
app/Services/MiddlewareService.php | 11 ++++++-----
app/Swoft.php | 11 ++++++-----
app/Tasks/SyncTask.php | 19 ++++++++++---------
bin/bootstrap.php | 11 ++++++-----
test/Cases/AbstractTestCase.php | 11 ++++++-----
test/Cases/DemoControllerTest.php | 11 ++++++-----
test/Cases/IndexControllerTest.php | 11 ++++++-----
test/Cases/MiddlewareTest.php | 11 ++++++-----
test/Cases/RedisControllerTest.php | 11 ++++++-----
test/Cases/RestTest.php | 11 ++++++-----
test/Cases/RouteTest.php | 11 ++++++-----
test/Cases/ValidatorControllerTest.php | 11 ++++++-----
test/bootstrap.php | 11 ++++++-----
58 files changed, 370 insertions(+), 312 deletions(-)
diff --git a/app/Boot/MyProcess.php b/app/Boot/MyProcess.php
index 7391565f..d87fba7d 100644
--- a/app/Boot/MyProcess.php
+++ b/app/Boot/MyProcess.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Boot;
diff --git a/app/Breaker/UserBreaker.php b/app/Breaker/UserBreaker.php
index 9ff2114e..0c254dac 100644
--- a/app/Breaker/UserBreaker.php
+++ b/app/Breaker/UserBreaker.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Breaker;
diff --git a/app/Commands/TestCommand.php b/app/Commands/TestCommand.php
index 9b39dc24..732b373e 100644
--- a/app/Commands/TestCommand.php
+++ b/app/Commands/TestCommand.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Commands;
diff --git a/app/Controllers/Admin/DemoController.php b/app/Controllers/Admin/DemoController.php
index 6680d243..f46c8d09 100644
--- a/app/Controllers/Admin/DemoController.php
+++ b/app/Controllers/Admin/DemoController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers\Admin;
diff --git a/app/Controllers/Api/RestController.php b/app/Controllers/Api/RestController.php
index 5ae8bac0..34cdbc85 100644
--- a/app/Controllers/Api/RestController.php
+++ b/app/Controllers/Api/RestController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers\Api;
diff --git a/app/Controllers/DemoController.php b/app/Controllers/DemoController.php
index 7af84059..fb4f86bf 100644
--- a/app/Controllers/DemoController.php
+++ b/app/Controllers/DemoController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
diff --git a/app/Controllers/ExceptionController.php b/app/Controllers/ExceptionController.php
index 3cb05d00..c4de3dba 100644
--- a/app/Controllers/ExceptionController.php
+++ b/app/Controllers/ExceptionController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
@@ -26,7 +27,7 @@ class ExceptionController
*/
public function exceptioin()
{
- throw new \Exception("this is exception");
+ throw new \Exception('this is exception');
}
/**
@@ -35,7 +36,7 @@ public function exceptioin()
*/
public function runtimeException()
{
- throw new RuntimeException("my exception");
+ throw new RuntimeException('my exception');
}
/**
@@ -44,7 +45,7 @@ public function runtimeException()
*/
public function defaultException()
{
- throw new ValidatorException("validator exception! ");
+ throw new ValidatorException('validator exception! ');
}
/**
@@ -53,6 +54,6 @@ public function defaultException()
*/
public function viewException()
{
- throw new BadMethodCallException("view exception! ");
+ throw new BadMethodCallException('view exception! ');
}
}
\ No newline at end of file
diff --git a/app/Controllers/HttpClientController.php b/app/Controllers/HttpClientController.php
index 07c3df16..111425de 100644
--- a/app/Controllers/HttpClientController.php
+++ b/app/Controllers/HttpClientController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
diff --git a/app/Controllers/IndexController.php b/app/Controllers/IndexController.php
index 880b3683..9a94d1c3 100644
--- a/app/Controllers/IndexController.php
+++ b/app/Controllers/IndexController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
@@ -195,7 +196,7 @@ public function raw()
*/
public function exception()
{
- throw new BadRequestException("bad request exception");
+ throw new BadRequestException('bad request exception');
}
/**
diff --git a/app/Controllers/MiddlewareController.php b/app/Controllers/MiddlewareController.php
index 64f09f69..3be7f67e 100644
--- a/app/Controllers/MiddlewareController.php
+++ b/app/Controllers/MiddlewareController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
diff --git a/app/Controllers/OrmController.php b/app/Controllers/OrmController.php
index 80d005a0..cbc28208 100644
--- a/app/Controllers/OrmController.php
+++ b/app/Controllers/OrmController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
@@ -57,7 +58,7 @@ public function arSave()
}
public function test(){
- $sql = "select * from user";
+ $sql = 'select * from user';
$em = EntityManager::create();
$result = $em->createQuery($sql)->execute()->getResult();
$em->close();
diff --git a/app/Controllers/Psr7Controller.php b/app/Controllers/Psr7Controller.php
index 48fa082d..aba85a4a 100644
--- a/app/Controllers/Psr7Controller.php
+++ b/app/Controllers/Psr7Controller.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
diff --git a/app/Controllers/RedisController.php b/app/Controllers/RedisController.php
index dd4119d9..44e7d54e 100644
--- a/app/Controllers/RedisController.php
+++ b/app/Controllers/RedisController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
@@ -38,9 +39,9 @@ public function testCache()
$result = $this->cache->set('name', 'swoft');
$name = $this->cache->get('name');
- $this->redis->incr("count");
+ $this->redis->incr('count');
- $this->redis->incrBy("count2", 2);
+ $this->redis->incrBy('count2', 2);
return [$result, $name, $this->redis->get('count'), $this->redis->get('count2'), '3'];
}
@@ -111,7 +112,7 @@ public function deleteMultiple()
public function has()
{
- $result = $this->cache->set("name666", 'swoft666');
+ $result = $this->cache->set('name666', 'swoft666');
$ret = $this->cache->has('name666');
return [$result, $ret];
diff --git a/app/Controllers/RestController.php b/app/Controllers/RestController.php
index e039165b..4b65e1a6 100644
--- a/app/Controllers/RestController.php
+++ b/app/Controllers/RestController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
@@ -48,7 +49,7 @@ public function create(Request $request)
$name = $request->input('name');
$bodyParams = $request->getBodyParams();
- $bodyParams = empty($bodyParams) ? ["create", $name] : $bodyParams;
+ $bodyParams = empty($bodyParams) ? ['create', $name] : $bodyParams;
return $bodyParams;
}
diff --git a/app/Controllers/RouteController.php b/app/Controllers/RouteController.php
index 4b47edaf..8321518c 100644
--- a/app/Controllers/RouteController.php
+++ b/app/Controllers/RouteController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
diff --git a/app/Controllers/RpcController.php b/app/Controllers/RpcController.php
index 19ce5dcc..f98a391c 100644
--- a/app/Controllers/RpcController.php
+++ b/app/Controllers/RpcController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
diff --git a/app/Controllers/SessionController.php b/app/Controllers/SessionController.php
index e3c8613f..15d5b1f0 100644
--- a/app/Controllers/SessionController.php
+++ b/app/Controllers/SessionController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
diff --git a/app/Controllers/TaskController.php b/app/Controllers/TaskController.php
index 2c27eab8..0fc61779 100644
--- a/app/Controllers/TaskController.php
+++ b/app/Controllers/TaskController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
diff --git a/app/Controllers/ValidatorController.php b/app/Controllers/ValidatorController.php
index a9dc29ae..124ac93c 100644
--- a/app/Controllers/ValidatorController.php
+++ b/app/Controllers/ValidatorController.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Controllers;
diff --git a/app/Exception/SwoftExceptionHandler.php b/app/Exception/SwoftExceptionHandler.php
index 3869fdfc..7e9e583d 100644
--- a/app/Exception/SwoftExceptionHandler.php
+++ b/app/Exception/SwoftExceptionHandler.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Exception;
@@ -81,7 +82,7 @@ public function handlerValidatorException(Response $response, \Throwable $throwa
{
$exception = $throwable->getMessage();
- return $response->json(["message" => $exception]);
+ return $response->json(['message' => $exception]);
}
/**
@@ -96,7 +97,7 @@ public function handlerBadRequestException(Response $response, \Throwable $throw
{
$exception = $throwable->getMessage();
- return $response->json(["message" => $exception]);
+ return $response->json(['message' => $exception]);
}
/**
diff --git a/app/Fallback/DemoServiceFallback.php b/app/Fallback/DemoServiceFallback.php
index fa9db9fe..33cdae6f 100644
--- a/app/Fallback/DemoServiceFallback.php
+++ b/app/Fallback/DemoServiceFallback.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Fallback;
@@ -33,7 +34,7 @@ public function getUser(string $id)
return ['fallback', 'getUser', func_get_args()];
}
- public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = "desc")
+ public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = 'desc')
{
return ['fallback', 'getUserByCond', func_get_args()];
}
diff --git a/app/Lib/DemoInterface.php b/app/Lib/DemoInterface.php
index 53fc3139..98ef8ff1 100644
--- a/app/Lib/DemoInterface.php
+++ b/app/Lib/DemoInterface.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Lib;
@@ -42,5 +43,5 @@ public function getUsers(array $ids);
*/
public function getUser(string $id);
- public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = "desc");
+ public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = 'desc');
}
\ No newline at end of file
diff --git a/app/Lib/MdDemoInterface.php b/app/Lib/MdDemoInterface.php
index 81288c55..1a2c2664 100644
--- a/app/Lib/MdDemoInterface.php
+++ b/app/Lib/MdDemoInterface.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Lib;
diff --git a/app/Listener/TaskFinish.php b/app/Listener/TaskFinish.php
index 8f71d9c1..f71e2229 100644
--- a/app/Listener/TaskFinish.php
+++ b/app/Listener/TaskFinish.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Listener;
@@ -26,6 +27,6 @@ class TaskFinish implements EventHandlerInterface
*/
public function handle(EventInterface $event)
{
- var_dump("task finish! ", $event->getParams());
+ var_dump('task finish! ', $event->getParams());
}
}
\ No newline at end of file
diff --git a/app/Middlewares/ActionTestMiddleware.php b/app/Middlewares/ActionTestMiddleware.php
index 780753d4..5abb74a6 100644
--- a/app/Middlewares/ActionTestMiddleware.php
+++ b/app/Middlewares/ActionTestMiddleware.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Middlewares;
diff --git a/app/Middlewares/ControllerSubMiddleware.php b/app/Middlewares/ControllerSubMiddleware.php
index 382ea7b8..4c10c72e 100644
--- a/app/Middlewares/ControllerSubMiddleware.php
+++ b/app/Middlewares/ControllerSubMiddleware.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Middlewares;
diff --git a/app/Middlewares/ControllerTestMiddleware.php b/app/Middlewares/ControllerTestMiddleware.php
index 10debae1..ee6d2c82 100644
--- a/app/Middlewares/ControllerTestMiddleware.php
+++ b/app/Middlewares/ControllerTestMiddleware.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Middlewares;
diff --git a/app/Middlewares/GroupTestMiddleware.php b/app/Middlewares/GroupTestMiddleware.php
index 2a080897..83458e92 100644
--- a/app/Middlewares/GroupTestMiddleware.php
+++ b/app/Middlewares/GroupTestMiddleware.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Middlewares;
diff --git a/app/Middlewares/ServiceMiddleware.php b/app/Middlewares/ServiceMiddleware.php
index 0ede6794..bbc7f5c0 100644
--- a/app/Middlewares/ServiceMiddleware.php
+++ b/app/Middlewares/ServiceMiddleware.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Middlewares;
diff --git a/app/Middlewares/ServiceSubMiddleware.php b/app/Middlewares/ServiceSubMiddleware.php
index 8b4c199b..32b42439 100644
--- a/app/Middlewares/ServiceSubMiddleware.php
+++ b/app/Middlewares/ServiceSubMiddleware.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Middlewares;
diff --git a/app/Middlewares/SubMiddleware.php b/app/Middlewares/SubMiddleware.php
index a4259bb5..5b830a93 100644
--- a/app/Middlewares/SubMiddleware.php
+++ b/app/Middlewares/SubMiddleware.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Middlewares;
diff --git a/app/Middlewares/SubMiddlewares.php b/app/Middlewares/SubMiddlewares.php
index 99495b82..159340c5 100644
--- a/app/Middlewares/SubMiddlewares.php
+++ b/app/Middlewares/SubMiddlewares.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Middlewares;
diff --git a/app/Models/Dao/UserDao.php b/app/Models/Dao/UserDao.php
index 950d227c..e788180d 100644
--- a/app/Models/Dao/UserDao.php
+++ b/app/Models/Dao/UserDao.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Models\Dao;
diff --git a/app/Models/Dao/UserExtDao.php b/app/Models/Dao/UserExtDao.php
index e79027b0..89de9aa4 100644
--- a/app/Models/Dao/UserExtDao.php
+++ b/app/Models/Dao/UserExtDao.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Models\Dao;
diff --git a/app/Models/Data/UserData.php b/app/Models/Data/UserData.php
index 55c854f3..89199717 100644
--- a/app/Models/Data/UserData.php
+++ b/app/Models/Data/UserData.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Models\Data;
diff --git a/app/Models/Data/UserExtData.php b/app/Models/Data/UserExtData.php
index fb0e5e0b..d7100060 100644
--- a/app/Models/Data/UserExtData.php
+++ b/app/Models/Data/UserExtData.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Models\Data;
diff --git a/app/Models/Entity/Count.php b/app/Models/Entity/Count.php
index 5ab7066f..b7785622 100644
--- a/app/Models/Entity/Count.php
+++ b/app/Models/Entity/Count.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Models\Entity;
diff --git a/app/Models/Entity/User.php b/app/Models/Entity/User.php
index 5bb238d7..3ecf8d18 100644
--- a/app/Models/Entity/User.php
+++ b/app/Models/Entity/User.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Models\Entity;
@@ -70,7 +71,7 @@ class User extends Model
* @Column(name="description", type="string")
* @var string
*/
- private $desc = "";
+ private $desc = '';
/**
* 非数据库字段,未定义映射关系
diff --git a/app/Models/Logic/IndexLogic.php b/app/Models/Logic/IndexLogic.php
index 45d2a482..9cd849e9 100644
--- a/app/Models/Logic/IndexLogic.php
+++ b/app/Models/Logic/IndexLogic.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Models\Logic;
diff --git a/app/Models/Logic/UserLogic.php b/app/Models/Logic/UserLogic.php
index 83ea20a9..b1783302 100644
--- a/app/Models/Logic/UserLogic.php
+++ b/app/Models/Logic/UserLogic.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Models\Logic;
diff --git a/app/Pool/Config/UserPoolConfig.php b/app/Pool/Config/UserPoolConfig.php
index 740df348..8e641581 100644
--- a/app/Pool/Config/UserPoolConfig.php
+++ b/app/Pool/Config/UserPoolConfig.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Pool\Config;
diff --git a/app/Pool/UserServicePool.php b/app/Pool/UserServicePool.php
index 82e47dfd..dfdcf1d1 100644
--- a/app/Pool/UserServicePool.php
+++ b/app/Pool/UserServicePool.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Pool;
diff --git a/app/Process/MyProcess.php b/app/Process/MyProcess.php
index abfd674a..2b5ad939 100644
--- a/app/Process/MyProcess.php
+++ b/app/Process/MyProcess.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Process;
diff --git a/app/Services/DemoService.php b/app/Services/DemoService.php
index 8670f67d..3bde2d77 100644
--- a/app/Services/DemoService.php
+++ b/app/Services/DemoService.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Services;
@@ -51,7 +52,7 @@ public function getUser(string $id)
* @param string $desc default value
* @return array
*/
- public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = "desc")
+ public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = 'desc')
{
return [$type, $uid, $name, $price, $desc];
}
diff --git a/app/Services/DemoServiceV2.php b/app/Services/DemoServiceV2.php
index e5445d10..eda1de26 100644
--- a/app/Services/DemoServiceV2.php
+++ b/app/Services/DemoServiceV2.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Services;
@@ -50,7 +51,7 @@ public function getUser(string $id)
* @param string $desc default value
* @return array
*/
- public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = "desc")
+ public function getUserByCond(int $type, int $uid, string $name, float $price, string $desc = 'desc')
{
return [$type, $uid, $name, $price, $desc];
}
diff --git a/app/Services/MiddlewareService.php b/app/Services/MiddlewareService.php
index 2fe429e5..42d12833 100644
--- a/app/Services/MiddlewareService.php
+++ b/app/Services/MiddlewareService.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Services;
diff --git a/app/Swoft.php b/app/Swoft.php
index 161089ee..944bfd14 100644
--- a/app/Swoft.php
+++ b/app/Swoft.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
class Swoft extends \Swoft\App
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index 55050204..440a6035 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace App\Tasks;
@@ -48,11 +49,11 @@ class SyncTask
*/
public function deliverCo(string $p1, string $p2)
{
- App::profileStart("co");
+ App::profileStart('co');
App::trace('trace');
App::info('info');
App::pushlog('key', 'stelin');
- App::profileEnd("co");
+ App::profileEnd('co');
return sprintf('deliverCo-%s-%s', $p1, $p2);
}
@@ -67,11 +68,11 @@ public function deliverCo(string $p1, string $p2)
*/
public function deliverAsync(string $p1, string $p2)
{
- App::profileStart("co");
+ App::profileStart('co');
App::trace('trace');
App::info('info');
App::pushlog('key', 'stelin');
- App::profileEnd("co");
+ App::profileEnd('co');
return sprintf('deliverCo-%s-%s', $p1, $p2);
}
diff --git a/bin/bootstrap.php b/bin/bootstrap.php
index a49cae19..9b1a4183 100644
--- a/bin/bootstrap.php
+++ b/bin/bootstrap.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
require_once dirname(__DIR__) . '/vendor/autoload.php';
diff --git a/test/Cases/AbstractTestCase.php b/test/Cases/AbstractTestCase.php
index 670fdc60..f29c922d 100644
--- a/test/Cases/AbstractTestCase.php
+++ b/test/Cases/AbstractTestCase.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Swoft\Test\Cases;
diff --git a/test/Cases/DemoControllerTest.php b/test/Cases/DemoControllerTest.php
index c51b6c8e..b5b97772 100644
--- a/test/Cases/DemoControllerTest.php
+++ b/test/Cases/DemoControllerTest.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Swoft\Test\Cases;
diff --git a/test/Cases/IndexControllerTest.php b/test/Cases/IndexControllerTest.php
index 03ad290f..0fcdcaba 100644
--- a/test/Cases/IndexControllerTest.php
+++ b/test/Cases/IndexControllerTest.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Swoft\Test\Cases;
diff --git a/test/Cases/MiddlewareTest.php b/test/Cases/MiddlewareTest.php
index 118a8e1d..7f58d35b 100644
--- a/test/Cases/MiddlewareTest.php
+++ b/test/Cases/MiddlewareTest.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Swoft\Test\Cases;
diff --git a/test/Cases/RedisControllerTest.php b/test/Cases/RedisControllerTest.php
index 919bfe88..3a70d92c 100644
--- a/test/Cases/RedisControllerTest.php
+++ b/test/Cases/RedisControllerTest.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Swoft\Test\Cases;
diff --git a/test/Cases/RestTest.php b/test/Cases/RestTest.php
index 0766d48d..cefdbbe7 100644
--- a/test/Cases/RestTest.php
+++ b/test/Cases/RestTest.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Swoft\Test\Cases;
diff --git a/test/Cases/RouteTest.php b/test/Cases/RouteTest.php
index 4f91a27a..d42ac088 100644
--- a/test/Cases/RouteTest.php
+++ b/test/Cases/RouteTest.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Swoft\Test\Cases;
diff --git a/test/Cases/ValidatorControllerTest.php b/test/Cases/ValidatorControllerTest.php
index 09246207..e856fbd9 100644
--- a/test/Cases/ValidatorControllerTest.php
+++ b/test/Cases/ValidatorControllerTest.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Swoft\Test\Cases;
diff --git a/test/bootstrap.php b/test/bootstrap.php
index 62da917e..1d450773 100644
--- a/test/bootstrap.php
+++ b/test/bootstrap.php
@@ -1,10 +1,11 @@
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ *
+ * @link https://swoft.org
+ * @document https://doc.swoft.org
+ * @contact group@swoft.org
+ * @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
require_once dirname(__DIR__) . '/vendor/autoload.php';
From 9f3063bfc966ea3b71e3823452a3f5405fbfda7c Mon Sep 17 00:00:00 2001
From: daydaygo <1252409767@qq.com>
Date: Mon, 12 Mar 2018 18:59:50 +0800
Subject: [PATCH 172/643] swoole enable http2
---
Dockerfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index b67ba368..472c07e4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,6 +13,7 @@ RUN apt-get update \
zip \
libz-dev \
libssl-dev \
+ libnghttp2-dev \
&& apt-get clean \
&& apt-get autoremove
@@ -41,7 +42,7 @@ RUN wget https://github.com/swoole/swoole-src/archive/v2.1.1.tar.gz -O swoole.ta
&& ( \
cd swoole \
&& phpize \
- && ./configure --enable-async-redis --enable-mysqlnd --enable-coroutine --enable-openssl \
+ && ./configure --enable-async-redis --enable-mysqlnd --enable-coroutine --enable-openssl --enable-http2 \
&& make -j$(nproc) \
&& make install \
) \
From f7737b83fe338c07bd60f9925d5247f126f112b9 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Wed, 14 Mar 2018 01:58:26 +0800
Subject: [PATCH 173/643] add demo
---
app/Controllers/HttpClientController.php | 4 +-
app/Controllers/OrmController.php | 120 ++++++++++++++++++++++-
app/Controllers/RedisController.php | 18 ++++
3 files changed, 135 insertions(+), 7 deletions(-)
diff --git a/app/Controllers/HttpClientController.php b/app/Controllers/HttpClientController.php
index 0c7fcc17..f4e777ca 100644
--- a/app/Controllers/HttpClientController.php
+++ b/app/Controllers/HttpClientController.php
@@ -19,8 +19,8 @@ class HttpClientController
public function request(): array
{
$client = new Client();
- $result = $client->get('https://www.swoft.org/')->getResult();
- $result2 = $client->get('https://www.swoft.org/')->getResponse()->getBody()->getContents();
+ $result = $client->get('http://www.swoft.org/')->getResult();
+ $result2 = $client->get('http://www.swoft.org/')->getResponse()->getBody()->getContents();
return compact('result', 'result2');
}
}
\ No newline at end of file
diff --git a/app/Controllers/OrmController.php b/app/Controllers/OrmController.php
index 2019d2e6..8cafc587 100644
--- a/app/Controllers/OrmController.php
+++ b/app/Controllers/OrmController.php
@@ -49,15 +49,126 @@ public function arSave()
return [$userResult, $countResult, $directUser, $directCount];
}
- public function test(){
- $sql = "select * from user";
+ public function ntotClose(){
+ $sql = "select * from user limit 2";
$em = EntityManager::create();
$result = $em->createQuery($sql)->execute()->getResult();
- $em->close();
+// $em->close();
return [$result];
}
+ public function notGetResult(){
+
+ $user2 = User::findById(4212)->getResult();
+ $user = User::findById(4212);
+ return [$user2];
+ }
+
+ /**
+ * @return array
+ */
+ public function notCommitAndClose()
+ {
+ $user2 = User::findById(4212)->getResult();
+
+ $user = new User();
+ $user->setName('stelin');
+ $user->setSex(1);
+ $user->setDesc('this my desc');
+ $user->setAge(mt_rand(1, 100));
+
+ $em = EntityManager::create();
+ $em->beginTransaction();
+ $result = $em->save($user)->getResult();
+
+ return [$user2, $result];
+ }
+
+ /**
+ * @return array
+ */
+ public function notCommitAndCloseAndGetResult()
+ {
+ $user2 = User::findById(4212)->getResult();
+
+ $user = new User();
+ $user->setName('stelin');
+ $user->setSex(1);
+ $user->setDesc('this my desc');
+ $user->setAge(mt_rand(1, 100));
+
+ $em = EntityManager::create();
+ $em->beginTransaction();
+ $result = $em->save($user);
+
+ return [$user2, $result];
+ }
+
+ /**
+ * @return array
+ */
+ public function notCommit()
+ {
+ $user2 = User::findById(4212)->getResult();
+
+ $user = new User();
+ $user->setName('stelin');
+ $user->setSex(1);
+ $user->setDesc('this my desc');
+ $user->setAge(mt_rand(1, 100));
+
+ $em = EntityManager::create();
+ $em->beginTransaction();
+ $result = $em->save($user)->getResult();
+ $em->close();
+
+ return [$user2, $result];
+ }
+
+ /**
+ * @return array
+ */
+ public function notCloseButCommit()
+ {
+ $user2 = User::findById(4212)->getResult();
+
+ $user = new User();
+ $user->setName('stelin');
+ $user->setSex(1);
+ $user->setDesc('this my desc');
+ $user->setAge(mt_rand(1, 100));
+
+ $em = EntityManager::create();
+ $em->beginTransaction();
+ $result = $em->save($user)->getResult();
+ $em->commit();
+
+ return [$user2, $result];
+ }
+
+ /**
+ * @return array
+ */
+ public function closeAndNotGetResult()
+ {
+ $user = new User();
+ $user->setName('stelin');
+ $user->setSex(1);
+ $user->setDesc('this my desc');
+ $user->setAge(mt_rand(1, 100));
+
+ $em = EntityManager::create();
+ $user2 = User::findById(4212)->getResult();
+ $em->beginTransaction();
+ $result = $em->save($user)->getResult();
+ $result = $em->save($user);
+ $em->commit();
+ $em->close();
+
+ return [$user2, $result];
+ }
+
/**
* EM查找
*/
@@ -324,10 +435,9 @@ public function query()
->orderBy('u.id', QueryBuilder::ORDER_BY_DESC)->limit(2)->execute();
// $result = $query->getResult();
$result = $result->getResult();
- $sql = $query->getSql();
$em->close();
- return [$result, $sql];
+ return [$result];
}
/**
diff --git a/app/Controllers/RedisController.php b/app/Controllers/RedisController.php
index 8dbca636..9ad0ad00 100644
--- a/app/Controllers/RedisController.php
+++ b/app/Controllers/RedisController.php
@@ -46,6 +46,14 @@ public function testRedis()
return [$result, $name];
}
+ public function error()
+ {
+ $result = $this->redis->set('nameRedis', 'swoft2');
+ $name = $this->redis->get('nameRedis');
+ $ret1 = $this->redis->deferCall('set', ['name1', 'swoft1']);
+ return [$name];
+ }
+
public function ab()
{
$result1 = User::query()->select('*')->where('id', '720')->limit(1)->execute()->getResult();
@@ -54,6 +62,16 @@ public function ab()
return [$result1, $result2];
}
+ public function ab2()
+ {
+ var_dump($this->redis->incr("count"));
+ var_dump($this->redis->incr("count"));
+ var_dump($this->redis->incr("count"));
+ var_dump($this->redis->incr("count"));
+ $ret1 = $this->redis->deferCall('set', ['name1', 'swoft1']);
+ return ['ab'];
+ }
+
public function testFunc()
{
$result = cache()->set('nameFunc', 'swoft3');
From 9c52ee86d36f2379d52e5dce568707b1672b5f7c Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 14 Mar 2018 20:00:18 +0800
Subject: [PATCH 174/643] update: update composer.json, fix packagist config
---
composer.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/composer.json b/composer.json
index 1a39e870..edb76e1c 100644
--- a/composer.json
+++ b/composer.json
@@ -53,10 +53,10 @@
],
"test": "./vendor/bin/phpunit -c phpunit.xml"
},
- "repositories": [
- {
- "type": "composer",
- "url": "https://packagist.phpcomposer.com/"
- }
- ]
+ "repositories": {
+ "packagist": {
+ "type": "composer",
+ "url": "https://packagist.phpcomposer.com/"
+ }
+ }
}
From 3c2fe900583b9f20a2052ff8e1125807cc2330b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E6=88=90=E9=83=BD?=
Date: Thu, 15 Mar 2018 21:26:28 +0800
Subject: [PATCH 175/643] =?UTF-8?q?=E5=A2=9E=E5=8A=A0env=E5=88=AB=E5=90=8D?=
=?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E6=94=AF=E6=8C=81=E5=8F=AF=E4=BB=A5?=
=?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89env=E6=96=87=E4=BB=B6=E8=B7=AF?=
=?UTF-8?q?=E5=BE=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/define.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/define.php b/config/define.php
index e013c2b8..2506af09 100644
--- a/config/define.php
+++ b/config/define.php
@@ -16,6 +16,7 @@
// Register alias
$aliases = [
'@root' => BASE_PATH,
+ '@env' => '@root',
'@app' => '@root/app',
'@res' => '@root/resources',
'@runtime' => '@root/runtime',
From a8c6f08897b79c874f04e553036a20d0ee67b8a9 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Fri, 16 Mar 2018 17:08:51 +0800
Subject: [PATCH 176/643] fix: error option name for http router
---
config/beans/base.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/beans/base.php b/config/beans/base.php
index 9827b9bf..ed4e7700 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -15,7 +15,7 @@
]
],
'httpRouter' => [
- 'ignoreLastSep' => false,
+ 'ignoreLastSlash' => false,
'tmpCacheNumber' => 1000,
'matchAll' => '',
],
From 7b9a5c7299d35f9f643f4a3dcb177fce3234294d Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Sat, 17 Mar 2018 04:40:24 +0800
Subject: [PATCH 177/643] Update Dockerfile
Added PDO Mysql extension
---
Dockerfile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Dockerfile b/Dockerfile
index 472c07e4..c692d568 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -23,6 +23,8 @@ RUN curl -sS https://getcomposer.org/installer | php \
RUN pecl install redis && docker-php-ext-enable redis && pecl clear-cache
+RUN docker-php-ext-install pdo_mysql
+
RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.gz \
&& mkdir -p hiredis \
&& tar -xf hiredis.tar.gz -C hiredis --strip-components=1 \
From e44c32419209bad5c786eb024f430008bc331f44 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Sun, 18 Mar 2018 22:53:35 +0800
Subject: [PATCH 178/643] Default closing log
---
.env.example | 4 +++
app/Controllers/IndexController.php | 11 ++++++++
app/Controllers/OrmController.php | 6 +++++
app/Controllers/RedisController.php | 17 ++++++++++++
app/Pool/Config/DemoRedisPoolConfig.php | 35 +++++++++++++++++++++++++
app/Pool/DemoRedisPool.php | 30 +++++++++++++++++++++
config/beans/base.php | 4 +++
config/beans/log.php | 7 ++---
config/properties/cache.php | 7 ++++-
9 files changed, 117 insertions(+), 4 deletions(-)
create mode 100644 app/Pool/Config/DemoRedisPoolConfig.php
create mode 100644 app/Pool/DemoRedisPool.php
diff --git a/.env.example b/.env.example
index 689e2f1f..fff4b45b 100644
--- a/.env.example
+++ b/.env.example
@@ -68,6 +68,10 @@ REDIS_MAX_IDLE_TIME=60
REDIS_TIMEOUT=3
REDIS_SERIALIZE=1
+# other redis node
+REDIS_DEMO_REDIS_DB=6
+REDIS_DEMO_REDIS_PREFIX=demo_redis_
+
# User service (demo service)
USER_POOL_NAME=user
USER_POOL_URI=127.0.0.1:8099,127.0.0.1:8099
diff --git a/app/Controllers/IndexController.php b/app/Controllers/IndexController.php
index 9a94d1c3..4a817832 100644
--- a/app/Controllers/IndexController.php
+++ b/app/Controllers/IndexController.php
@@ -10,8 +10,10 @@
namespace App\Controllers;
+use Swoft\App;
use Swoft\Http\Server\Bean\Annotation\Controller;
use Swoft\Http\Server\Bean\Annotation\RequestMapping;
+use Swoft\Log\Log;
use Swoft\View\Bean\Annotation\View;
use Swoft\Contract\Arrayable;
use Swoft\Http\Server\Exception\BadRequestException;
@@ -190,6 +192,15 @@ public function raw()
return $name;
}
+ public function testLog()
+ {
+ App::trace('this is app trace');
+ Log::trace('this is log trace');
+ App::error('this is log error');
+ Log::trace('this is log error');
+ return ['log'];
+ }
+
/**
* @RequestMapping()
* @throws \Swoft\Http\Server\Exception\BadRequestException
diff --git a/app/Controllers/OrmController.php b/app/Controllers/OrmController.php
index 727af3ce..0fd52216 100644
--- a/app/Controllers/OrmController.php
+++ b/app/Controllers/OrmController.php
@@ -196,6 +196,12 @@ public function save()
return [$result];
}
+ public function forceMater()
+ {
+ $user = User::findById(4212, 'default.master')->getResult();
+ return [$user];
+ }
+
/**
* 实体内容删除
*/
diff --git a/app/Controllers/RedisController.php b/app/Controllers/RedisController.php
index f7b15529..293c1e10 100644
--- a/app/Controllers/RedisController.php
+++ b/app/Controllers/RedisController.php
@@ -34,6 +34,23 @@ class RedisController
*/
private $redis;
+ /**
+ * @Inject("demoRedis")
+ * @var \Swoft\Redis\Redis
+ */
+ private $demoRedis;
+
+ public function testDemoRedis()
+ {
+ $result = $this->demoRedis->set('name', 'swoft');
+ $name = $this->demoRedis->get('name');
+
+ $this->demoRedis->incr('count');
+ $this->demoRedis->incrBy('count2', 2);
+
+ return [$result, $name, $this->demoRedis->get('count'), $this->demoRedis->get('count2'), '3'];
+ }
+
public function testCache()
{
$result = $this->cache->set('name', 'swoft');
diff --git a/app/Pool/Config/DemoRedisPoolConfig.php b/app/Pool/Config/DemoRedisPoolConfig.php
new file mode 100644
index 00000000..087b427c
--- /dev/null
+++ b/app/Pool/Config/DemoRedisPoolConfig.php
@@ -0,0 +1,35 @@
+ [
'driver' => 'redis',
],
+ 'demoRedis' => [
+ 'class' => \Swoft\Redis\Redis::class,
+ 'poolName' => 'demoRedis'
+ ]
];
diff --git a/config/beans/log.php b/config/beans/log.php
index 7e7e18ba..732e5e06 100644
--- a/config/beans/log.php
+++ b/config/beans/log.php
@@ -28,10 +28,11 @@
\Swoft\Log\Logger::WARNING,
],
],
- 'logger' => [
+ 'logger' => [
'name' => APP_NAME,
- 'flushInterval' => 100000,
- 'flushRequest' => false,
+ 'enable' => false,
+ 'flushInterval' => 100,
+ 'flushRequest' => true,
'handlers' => [
'${noticeHandler}',
'${applicationHandler}',
diff --git a/config/properties/cache.php b/config/properties/cache.php
index d3a13877..28328aff 100644
--- a/config/properties/cache.php
+++ b/config/properties/cache.php
@@ -8,7 +8,7 @@
*/
return [
- 'redis' => [
+ 'redis' => [
'name' => 'redis',
'uri' => [
'127.0.0.1:6379',
@@ -21,6 +21,11 @@
'maxIdleTime' => 60,
'timeout' => 8,
'db' => 1,
+ 'prefix' => 'redis_',
'serialize' => 0,
],
+ 'demoRedis' => [
+ 'db' => 2,
+ 'prefix' => 'demo_redis_',
+ ],
];
\ No newline at end of file
From 8586e0dfe23929ccd685a9e6da454538536ab4bb Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 21 Mar 2018 10:41:34 +0800
Subject: [PATCH 179/643] up: add example route /routes
access /routes you can see all registered routes.
---
app/Controllers/RouteController.php | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/app/Controllers/RouteController.php b/app/Controllers/RouteController.php
index 8321518c..6e9a3d05 100644
--- a/app/Controllers/RouteController.php
+++ b/app/Controllers/RouteController.php
@@ -30,6 +30,23 @@ public function index()
return 'index';
}
+ /**
+ * access /routes you can see all registered routes.
+ * @RequestMapping("/routes")
+ */
+ public function routes(): array
+ {
+ /** @var \Swoft\Http\Server\Router\HandlerMapping $router */
+ $router = \bean('httpRouter');
+
+ return [
+ 'static' => $router->getStaticRoutes(),
+ 'regular' => $router->getRegularRoutes(),
+ 'vague' => $router->getVagueRoutes(),
+ 'cached' => $router->getCacheRoutes(),
+ ];
+ }
+
/**
* @RequestMapping(route="user/{uid}/book/{bid}/{bool}/{name}")
*
@@ -137,4 +154,4 @@ public function behind(Request $request)
{
return [get_class($request)];
}
-}
\ No newline at end of file
+}
From 2ee51589127f81d4d3ec8d240de24d90c09d9fc1 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 21 Mar 2018 19:31:11 +0800
Subject: [PATCH 180/643] add path alias for vendor dir
---
config/define.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/define.php b/config/define.php
index 2506af09..666495b4 100644
--- a/config/define.php
+++ b/config/define.php
@@ -26,6 +26,7 @@
'@properties' => '@configs/properties',
'@console' => '@beans/console.php',
'@commands' => '@app/command',
+ '@vendor' => '@root/vendor',
];
\Swoft\App::setAliases($aliases);
From 0666326f035630739a9f7970a80342aff4f35c72 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 21 Mar 2018 19:32:34 +0800
Subject: [PATCH 181/643] up: add ws settings
---
config/server.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/config/server.php b/config/server.php
index 35085e57..714d03db 100644
--- a/config/server.php
+++ b/config/server.php
@@ -29,6 +29,12 @@
'mode' => env('HTTP_MODE', SWOOLE_PROCESS),
'type' => env('HTTP_TYPE', SWOOLE_SOCK_TCP),
],
+ 'ws' => [
+ // enable handler http request ?
+ 'enable_http' => true,
+ // other settings will extend the 'http' config
+ // you can define separately to overwrite existing settings
+ ],
'crontab' => [
'task_count' => env('CRONTAB_TASK_COUNT', 1024),
'task_queue' => env('CRONTAB_TASK_QUEUE', 2048),
@@ -48,4 +54,4 @@
'ssl_cert_file' => env('SSL_CERT_FILE', ''),
'ssl_key_file' => env('SSL_KEY_FILE', ''),
],
-];
\ No newline at end of file
+];
From 38688ca07663002113ac3f600f3bf76ad9b4d10c Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 21 Mar 2018 19:34:02 +0800
Subject: [PATCH 182/643] Update server.php
---
config/server.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/server.php b/config/server.php
index 714d03db..584b0c05 100644
--- a/config/server.php
+++ b/config/server.php
@@ -30,7 +30,7 @@
'type' => env('HTTP_TYPE', SWOOLE_SOCK_TCP),
],
'ws' => [
- // enable handler http request ?
+ // enable handle http request ?
'enable_http' => true,
// other settings will extend the 'http' config
// you can define separately to overwrite existing settings
From 75a8c6d4be61e33b83b307b79099dc055cd9cfec Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Wed, 21 Mar 2018 19:52:05 +0800
Subject: [PATCH 183/643] validator and console task
---
.env.example | 3 +++
app/Commands/TestCommand.php | 26 +++++++++++++++++++++++++-
app/Controllers/IndexController.php | 2 +-
app/Tasks/SyncTask.php | 10 ++++++++--
config/server.php | 9 ++++++---
5 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/.env.example b/.env.example
index fff4b45b..e42feb1d 100644
--- a/.env.example
+++ b/.env.example
@@ -29,6 +29,9 @@ WORKER_NUM=1
MAX_REQUEST=100000
DAEMONIZE=0
DISPATCH_MODE=2
+TASK_IPC_MODE=3
+MESSAGE_QUEUE_KEY=1879052289
+TASK_TMPDIR=/tmp/
LOG_FILE=@runtime/logs/swoole.log
TASK_WORKER_NUM=1
PACKAGE_MAX_LENGTH=2048
diff --git a/app/Commands/TestCommand.php b/app/Commands/TestCommand.php
index 732b373e..3e069905 100644
--- a/app/Commands/TestCommand.php
+++ b/app/Commands/TestCommand.php
@@ -18,11 +18,12 @@
use Swoft\Console\Output\Output;
use Swoft\Core\Coroutine;
use Swoft\Log\Log;
+use Swoft\Task\Task;
/**
* Test command
*
- * @Command(coroutine=true)
+ * @Command(coroutine=false)
*/
class TestCommand
{
@@ -88,4 +89,27 @@ public function demo()
$data = $logic->getUserInfo(['uid1']);
var_dump($hasOpt, $opt, $name, $data);
}
+
+ /**
+ * this task command
+ *
+ * @Usage
+ * test:{command} [arguments] [options]
+ *
+ * @Options
+ * -o,--o this is command option
+ *
+ * @Arguments
+ * arg this is argument
+ *
+ * @Example
+ * php swoft test:task
+ *
+ * @Mapping()
+ */
+ public function task()
+ {
+ $result = Task::deliver('sync', 'console', ['console']);
+ var_dump($result);
+ }
}
\ No newline at end of file
diff --git a/app/Controllers/IndexController.php b/app/Controllers/IndexController.php
index 4a817832..22702891 100644
--- a/app/Controllers/IndexController.php
+++ b/app/Controllers/IndexController.php
@@ -11,6 +11,7 @@
namespace App\Controllers;
use Swoft\App;
+use Swoft\Core\Coroutine;
use Swoft\Http\Server\Bean\Annotation\Controller;
use Swoft\Http\Server\Bean\Annotation\RequestMapping;
use Swoft\Log\Log;
@@ -219,5 +220,4 @@ public function redirect(Response $response): Response
{
return $response->redirect('/');
}
-
}
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index 440a6035..f93b9d1b 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -95,9 +95,9 @@ public function cache()
* @return array
*/
public function mysql(){
- $result = User::findById(720)->getResult();
+ $result = User::findById(4212)->getResult();
- $query = User::findById(720);
+ $query = User::findById(4212);
/* @var User $user */
$user = $query->getResult(User::class);
@@ -120,6 +120,12 @@ public function http()
return $data;
}
+ public function console(string $data)
+ {
+ var_dump('console', $data);
+ return ['console'];
+ }
+
/**
* Rpc task
*
diff --git a/config/server.php b/config/server.php
index 35085e57..6de3397a 100644
--- a/config/server.php
+++ b/config/server.php
@@ -44,8 +44,11 @@
'upload_tmp_dir' => env('UPLOAD_TMP_DIR', '@runtime/uploadfiles'),
'document_root' => env('DOCUMENT_ROOT', BASE_PATH . '/public'),
'enable_static_handler' => env('ENABLE_STATIC_HANDLER', true),
- 'open_http2_protocol' => env('OPEN_HTTP2_PROTOCOL', false),
- 'ssl_cert_file' => env('SSL_CERT_FILE', ''),
- 'ssl_key_file' => env('SSL_KEY_FILE', ''),
+ 'open_http2_protocol' => env('OPEN_HTTP2_PROTOCOL', false),
+ 'ssl_cert_file' => env('SSL_CERT_FILE', ''),
+ 'ssl_key_file' => env('SSL_KEY_FILE', ''),
+ 'task_ipc_mode' => env('TASK_IPC_MODE', 3),
+ 'message_queue_key' => env('MESSAGE_QUEUE_KEY', 0x70001001),
+ 'task_tmpdir' => env('TASK_TMPDIR', '/tmp'),
],
];
\ No newline at end of file
From b1fdede52bbd47c8cb29f2876f88dc11665b63fb Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Thu, 22 Mar 2018 07:59:10 +0800
Subject: [PATCH 184/643] Update define.php
Format
---
config/define.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/define.php b/config/define.php
index 666495b4..2a9a32d2 100644
--- a/config/define.php
+++ b/config/define.php
@@ -26,7 +26,7 @@
'@properties' => '@configs/properties',
'@console' => '@beans/console.php',
'@commands' => '@app/command',
- '@vendor' => '@root/vendor',
+ '@vendor' => '@root/vendor',
];
\Swoft\App::setAliases($aliases);
From d20761bc7401d5254dd539296e76bfa16b9d6921 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Thu, 22 Mar 2018 07:59:38 +0800
Subject: [PATCH 185/643] Update server.php
---
config/server.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/server.php b/config/server.php
index 584b0c05..753b3d41 100644
--- a/config/server.php
+++ b/config/server.php
@@ -31,7 +31,7 @@
],
'ws' => [
// enable handle http request ?
- 'enable_http' => true,
+ 'enable_http' => env('WS_ENABLE_HTTP', true),
// other settings will extend the 'http' config
// you can define separately to overwrite existing settings
],
From cd281432a7b1fb0e39c19e3f9b3ef1fe8170b8fb Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 23 Mar 2018 17:12:44 +0800
Subject: [PATCH 186/643] task and rpc
---
.env.example | 2 +-
app/Tasks/SyncTask.php | 8 +++++++-
config/server.php | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/.env.example b/.env.example
index e42feb1d..35323b55 100644
--- a/.env.example
+++ b/.env.example
@@ -29,7 +29,7 @@ WORKER_NUM=1
MAX_REQUEST=100000
DAEMONIZE=0
DISPATCH_MODE=2
-TASK_IPC_MODE=3
+TASK_IPC_MODE=2
MESSAGE_QUEUE_KEY=1879052289
TASK_TMPDIR=/tmp/
LOG_FILE=@runtime/logs/swoole.log
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index f93b9d1b..ec68852e 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -133,7 +133,13 @@ public function console(string $data)
*/
public function rpc()
{
- return $this->demoService->getUser('6666');
+ $user = $this->demoService->getUser('6666');
+ $defer1 = $this->demoService->deferGetUser('666');
+ $defer2 = $this->demoService->deferGetUser('888');
+
+ $result1 = $defer1->getResult();
+ $result2 = $defer2->getResult();
+ return [$user, $result1, $result2];
}
/**
diff --git a/config/server.php b/config/server.php
index 6de3397a..30288b6c 100644
--- a/config/server.php
+++ b/config/server.php
@@ -47,7 +47,7 @@
'open_http2_protocol' => env('OPEN_HTTP2_PROTOCOL', false),
'ssl_cert_file' => env('SSL_CERT_FILE', ''),
'ssl_key_file' => env('SSL_KEY_FILE', ''),
- 'task_ipc_mode' => env('TASK_IPC_MODE', 3),
+ 'task_ipc_mode' => env('TASK_IPC_MODE', 2),
'message_queue_key' => env('MESSAGE_QUEUE_KEY', 0x70001001),
'task_tmpdir' => env('TASK_TMPDIR', '/tmp'),
],
From 7f565d70b3205a421dd250a0dfbc83ee8715b8f3 Mon Sep 17 00:00:00 2001
From: inhere
Date: Mon, 26 Mar 2018 16:20:30 +0800
Subject: [PATCH 187/643] up: update some config for websocket
---
.env.example | 5 ++-
.gitignore | 3 +-
app/WebSocket/EchoController.php | 54 ++++++++++++++++++++++++++++++++
composer.json | 3 +-
config/beans/base.php | 3 +-
config/properties/app.php | 3 +-
phar.build.inc | 41 ++++++++++++++++++++++++
7 files changed, 107 insertions(+), 5 deletions(-)
create mode 100644 app/WebSocket/EchoController.php
create mode 100644 phar.build.inc
diff --git a/.env.example b/.env.example
index 35323b55..3a69ebb9 100644
--- a/.env.example
+++ b/.env.example
@@ -12,6 +12,9 @@ HTTP_PORT=80
HTTP_MODE=SWOOLE_PROCESS
HTTP_TYPE=SWOOLE_SOCK_TCP
+# WebSocket
+WS_ENABLE_HTTP=true
+
# TCP
TCP_HOST=0.0.0.0
TCP_PORT=8099
@@ -103,4 +106,4 @@ CONSUL_REGISTER_SERVICE_PORT=8099
CONSUL_REGISTER_CHECK_NAME=user
CONSUL_REGISTER_CHECK_TCP=127.0.0.1:8099
CONSUL_REGISTER_CHECK_INTERVAL=10
-CONSUL_REGISTER_CHECK_TIMEOUT=1
\ No newline at end of file
+CONSUL_REGISTER_CHECK_TIMEOUT=1
diff --git a/.gitignore b/.gitignore
index 579da2f0..36b10d75 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,4 +9,5 @@ vendor/
temp/
*.lock
.phpintel/
-.env
\ No newline at end of file
+.env
+.DS_Store
diff --git a/app/WebSocket/EchoController.php b/app/WebSocket/EchoController.php
new file mode 100644
index 00000000..93204b1b
--- /dev/null
+++ b/app/WebSocket/EchoController.php
@@ -0,0 +1,54 @@
+push($fd, 'hello, welcome! :)');
+ }
+
+ /**
+ * @param Server $server
+ * @param Frame $frame
+ */
+ public function onMessage(Server $server, Frame $frame)
+ {
+ $server->push($frame->fd, 'hello, I have received your message: ' . $frame->data);
+ }
+
+ /**
+ * @param Server $server
+ * @param int $fd
+ */
+ public function onClose(Server $server, int $fd)
+ {
+ $server->push($fd, 'oo, goodbye! :)');
+ }
+}
diff --git a/composer.json b/composer.json
index edb76e1c..0781e45d 100644
--- a/composer.json
+++ b/composer.json
@@ -36,7 +36,8 @@
},
"autoload": {
"psr-4": {
- "App\\": "app/"
+ "App\\": "app/",
+ "Swoft\\WebSocket\\Server\\": "vendor/swoft/websocket-server/src/"
},
"files": [
"app/Swoft.php"
diff --git a/config/beans/base.php b/config/beans/base.php
index ff2983ac..8711d971 100644
--- a/config/beans/base.php
+++ b/config/beans/base.php
@@ -11,7 +11,8 @@
'serverDispatcher' => [
'middlewares' => [
\Swoft\View\Middleware\ViewMiddleware::class,
- //\Swoft\Session\Middleware\SessionMiddleware::class,
+ // \Swoft\Devtool\Middleware\DevToolMiddleware::class,
+ // \Swoft\Session\Middleware\SessionMiddleware::class,
]
],
'httpRouter' => [
diff --git a/config/properties/app.php b/config/properties/app.php
index eb41508a..6e3cb07a 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -26,6 +26,7 @@
'App\Listener',
'App\Process',
'App\Fallback',
+ 'App\WebSocket',
],
'I18n' => [
'sourceLanguage' => '@root/resources/messages/',
@@ -36,4 +37,4 @@
'service' => require __DIR__ . DS . 'service.php',
'breaker' => require __DIR__ . DS . 'breaker.php',
'provider' => require __DIR__ . DS . 'provider.php',
-];
\ No newline at end of file
+];
diff --git a/phar.build.inc b/phar.build.inc
new file mode 100644
index 00000000..31640221
--- /dev/null
+++ b/phar.build.inc
@@ -0,0 +1,41 @@
+stripComments(true)
+ ->setShebang(true)
+ ->addSuffix('.json')// for add composer.json
+ ->addExclude([
+ 'test',
+ 'tests',
+ 'runtime',
+ 'eaglewu',
+ ])
+ ->addFile([
+ 'LICENSE',
+ 'README.md',
+ ])
+ ->setCliIndex('bin/swoft')
+ // ->setWebIndex('web/index.php')
+ // ->setVersionFile('config/config.php')
+;
+
+// Command Controller 命令类不去除注释,注释上是命令帮助信息
+$compiler->setStripFilter(function ($file) {
+ /** @var \SplFileInfo $file */
+ $path = $file->getPath();
+
+ if (strpos($path, 'swoft')) {
+ return false;
+ }
+
+ return false === strpos($file->getFilename(), 'Command.php');
+});
From ea14dcd6c63706877bdda8b0797dd81276773f20 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Mon, 26 Mar 2018 23:00:32 +0800
Subject: [PATCH 188/643] Update composer.json
---
composer.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/composer.json b/composer.json
index 0781e45d..47835412 100644
--- a/composer.json
+++ b/composer.json
@@ -16,6 +16,7 @@
"swoft/rpc-client": "^1.0",
"swoft/http-server": "^1.0",
"swoft/http-client": "^1.0",
+ "swoft/websocket-server": "^1.0",
"swoft/task": "^1.0",
"swoft/http-message": "^1.0",
"swoft/view": "^1.0",
From c7f8ace97942e56d1019fb3883d8fdea942af6d5 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Tue, 27 Mar 2018 14:59:30 +0800
Subject: [PATCH 189/643] Update composer.json
---
composer.json | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/composer.json b/composer.json
index 47835412..c73590b8 100644
--- a/composer.json
+++ b/composer.json
@@ -37,8 +37,7 @@
},
"autoload": {
"psr-4": {
- "App\\": "app/",
- "Swoft\\WebSocket\\Server\\": "vendor/swoft/websocket-server/src/"
+ "App\\": "app/"
},
"files": [
"app/Swoft.php"
From 92f46d71c756318f051dc0f7a7b7244f3bd3c02b Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 28 Mar 2018 09:17:23 +0800
Subject: [PATCH 190/643] Update README.md
---
README.md | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 4cf3d59b..1549db7d 100644
--- a/README.md
+++ b/README.md
@@ -4,13 +4,22 @@
-[](https://github.com/swoft-cloud/swoft/releases)
-[](https://travis-ci.org/swoft-cloud/swoft)
-[](https://secure.php.net/)
-[](https://github.com/swoole/swoole-src)
-[](https://github.com/redis/hiredis)
-[](https://doc.swoft.org)
-[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
+
# 简介
首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈组件化框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的 PHP-FPM,全异步非阻塞 IO 实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield, 有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
From b6a3192a7fb2e4e3c4c64e7cb5a194fade4b5ac5 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 28 Mar 2018 09:22:12 +0800
Subject: [PATCH 191/643] Update README.md
---
README.md | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 1549db7d..aac7540b 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@
- 基于 Swoole 扩展
- 内置协程网络服务器
+- webSocket 服务器
- 强大的 AOP (面向切面编程)
- 灵活完善的注解功能
- 全局的依赖注入容器
@@ -58,7 +59,7 @@ QQ 交流群: 548173319
# 环境要求
1. PHP 7.0 +
-2. [Swoole 2.0.12](https://github.com/swoole/swoole-src/releases) +, 需开启协程和异步Redis
+2. [Swoole 2.1.1](https://github.com/swoole/swoole-src/releases) +, 需开启协程和异步Redis
3. [Hiredis](https://github.com/redis/hiredis/releases)
4. [Composer](https://getcomposer.org/)
@@ -74,9 +75,11 @@ QQ 交流群: 548173319
* `composer create-project swoft/swoft swoft`
## Docker 安装
+
* `docker run -p 80:80 swoft/swoft`
## Docker-Compose 安装
+
* `cd swoft`
* `docker-compose up`
@@ -96,6 +99,9 @@ AUTO_RELOAD=true
HTTP_HOST=0.0.0.0
HTTP_PORT=80
+# WebSocket
+WS_ENABLE_HTTP=true
+
# TCP
TCP_HOST=0.0.0.0
TCP_PORT=8099
@@ -120,7 +126,7 @@ TASK_WORKER_NUM=1
**帮助命令**
```
-[root@swoft bin]# php swoft -h
+[root@swoft]# php bin/swoft -h
____ __ _
/ ___|_ _____ / _| |_
\___ \ \ /\ / / _ \| |_| __|
@@ -128,16 +134,18 @@ TASK_WORKER_NUM=1
|____/ \_/\_/ \___/|_| \__|
Usage:
- php swoft -h
+ php bin/swoft -h
Commands:
- entity the group command list of database entity
- rpc the group command list of rpc server
- server the group command list of http-server
+ entity The group command list of database entity
+ gen Generate some common application template classes
+ rpc The group command list of rpc server
+ server The group command list of http-server
+ ws There some commands for manage the webSocket server
Options:
- -v,--version show version
- -h,--help show help
+ -v, --version show version
+ -h, --help show help
```
**HTTP启动**
@@ -162,7 +170,6 @@ php bin/swoft stop
```
-
**RPC启动**
> 启动独立的RPC服务器
From a4b7435d855b754ef0d578b80148d9f6acee1a3d Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Fri, 30 Mar 2018 02:41:43 +0800
Subject: [PATCH 192/643] Update .php_cs
Use psr-2 rules
---
.php_cs | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/.php_cs b/.php_cs
index 9ff88fcc..41e1b734 100644
--- a/.php_cs
+++ b/.php_cs
@@ -3,15 +3,16 @@
$header = <<<'EOF'
This file is part of Swoft.
-@link https://swoft.org
+@link https://swoft.org
@document https://doc.swoft.org
-@contact group@swoft.org
-@license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
+@contact group@swoft.org
+@license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
EOF;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
+ '@PSR2' => true,
'header_comment' => [
'commentType' => 'PHPDoc',
'header' => $header,
@@ -21,6 +22,9 @@ return PhpCsFixer\Config::create()
'syntax' => 'short'
],
'single_quote' => true,
+ 'class_attributes_separation' => true,
+ 'no_unused_imports' => true,
+ 'standardize_not_equals' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
From 5ac20c82a3a0b92a2113cbfeeb3f6faf4796599b Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Fri, 30 Mar 2018 23:56:04 +0800
Subject: [PATCH 193/643] Update changelog.md
---
changelog.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/changelog.md b/changelog.md
index 1f82c665..0159f240 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,6 @@
+# 2018-01-05
+* 组件化拆分
+
# 2018-01-05
* 重构HttpClient
* 重构Redis
From 4a4de143e474eb037158023a3dc61197b1c786c5 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Fri, 30 Mar 2018 23:56:17 +0800
Subject: [PATCH 194/643] Update changelog.md
---
changelog.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/changelog.md b/changelog.md
index 0159f240..d85aa9f9 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,4 @@
-# 2018-01-05
+# 2018-03-05
* 组件化拆分
# 2018-01-05
From ebcd9e1933b9de44811cb5fa0feb20ef928b454c Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Sun, 1 Apr 2018 23:35:05 +0800
Subject: [PATCH 195/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index aac7540b..cdd8d52f 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
-
+
From 7fa7f4fbed76536f3cf5945e84e0641b828ec529 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Mon, 2 Apr 2018 10:25:23 +0800
Subject: [PATCH 196/643] Update README.md
---
README.md | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index cdd8d52f..8ce09e41 100644
--- a/README.md
+++ b/README.md
@@ -121,11 +121,11 @@ LOG_FILE=@runtime/swoole.log
TASK_WORKER_NUM=1
```
-## 启动
+## 管理
-**帮助命令**
+### 帮助命令
-```
+```text
[root@swoft]# php bin/swoft -h
____ __ _
/ ___|_ _____ / _| |_
@@ -134,7 +134,7 @@ TASK_WORKER_NUM=1
|____/ \_/\_/ \___/|_| \__|
Usage:
- php bin/swoft -h
+ php bin/swoft {command} [arguments ...] [options ...]
Commands:
entity The group command list of database entity
@@ -148,11 +148,11 @@ Options:
-h, --help show help
```
-**HTTP启动**
+## HTTP Server启动
> 是否同时启动RPC服务器取决于.env文件配置
-```php
+```bash
// 启动服务,根据 .env 配置决定是否是守护进程
php bin/swoft start
@@ -167,14 +167,34 @@ php bin/swoft reload
// 关闭服务
php bin/swoft stop
+```
+
+### WebSocket Server启动
+
+启动WebSocket服务器,可选是否同时支持http处理
+```bash
+// 启动服务,根据 .env 配置决定是否是守护进程
+php bin/swoft ws:start
+
+// 守护进程启动,覆盖 .env 守护进程(DAEMONIZE)的配置
+php bin/swoft ws:start -d
+
+// 重启
+php bin/swoft ws:restart
+
+// 重新加载
+php bin/swoft ws:reload
+
+// 关闭服务
+php bin/swoft ws:stop
```
-**RPC启动**
+## RPC Server启动
> 启动独立的RPC服务器
-```php
+```bash
// 启动服务,根据 .env 配置决定是否是守护进程
php bin/swoft rpc:start
From 029f6e797e2818891b7a403736cb8658ab66a9ad Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Mon, 9 Apr 2018 18:00:11 +0800
Subject: [PATCH 197/643] Merge network server
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 8ce09e41..0c8efe90 100644
--- a/README.md
+++ b/README.md
@@ -25,8 +25,7 @@
首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈组件化框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的 PHP-FPM,全异步非阻塞 IO 实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield, 有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
- 基于 Swoole 扩展
-- 内置协程网络服务器
-- webSocket 服务器
+- 内置协程 HTTP, TCP, WebSocket 网络服务器
- 强大的 AOP (面向切面编程)
- 灵活完善的注解功能
- 全局的依赖注入容器
From 8497da0a47625848e52fe95a51f88f0dc1eadc70 Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Mon, 9 Apr 2018 18:10:23 +0800
Subject: [PATCH 198/643] Revert badge to markdown syntax
---
README.md | 26 +++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/README.md b/README.md
index 0c8efe90..c3841458 100644
--- a/README.md
+++ b/README.md
@@ -4,25 +4,17 @@
-
+[](https://github.com/swoft-cloud/swoft/releases)
+[](https://travis-ci.org/swoft-cloud/swoft)
+[](https://secure.php.net/)
+[](https://github.com/swoole/swoole-src)
+[](https://github.com/redis/hiredis)
+[](https://doc.swoft.org)
+[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
+
# 简介
-首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈组件化框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的 PHP-FPM,全异步非阻塞 IO 实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield, 有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
+首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈组件化框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的 PHP-FPM,全异步非阻塞 IO 实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield,有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
- 基于 Swoole 扩展
- 内置协程 HTTP, TCP, WebSocket 网络服务器
From 6c7e504337b641ec578e4db51fd38487dd38d672 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Tue, 10 Apr 2018 12:02:31 +0800
Subject: [PATCH 199/643] Update EchoController.php
---
app/WebSocket/EchoController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/WebSocket/EchoController.php b/app/WebSocket/EchoController.php
index 93204b1b..867903ce 100644
--- a/app/WebSocket/EchoController.php
+++ b/app/WebSocket/EchoController.php
@@ -49,6 +49,6 @@ public function onMessage(Server $server, Frame $frame)
*/
public function onClose(Server $server, int $fd)
{
- $server->push($fd, 'oo, goodbye! :)');
+ // do something. eg. record log, unbind user ...
}
}
From 91d405cb1cd4ef0f6f37860f273c9ae148fcb0c7 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Tue, 10 Apr 2018 12:06:39 +0800
Subject: [PATCH 200/643] Update changelog.md
---
changelog.md | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/changelog.md b/changelog.md
index d85aa9f9..84fb4b71 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,15 @@
+# Change log
+
+# 2018-04-05
+
+* 添加 websocket 支持
+* 完成基本的 devtool
+
# 2018-03-05
* 组件化拆分
# 2018-01-05
+
* 重构HttpClient
* 重构Redis
* 创建实体新增特殊变量别名
@@ -26,41 +34,67 @@
* 新增HTTP、RPC验证器
* 新增HTTP、RPC中间件
+
# 2017-12-2
+
* 新增RESTful风格兼容
+
# 2017-11-29
+
* 重构请求流程
* 简化控制器和RPC服务操作
* 增加 创建实体 操作
+
# 2017-11-15
+
* 增加 Pipeline 组件
+
# 2017-11-13
+
* 增加 PHPUnit 单元测试
+
# 2017-11-12
+
* 根据 Psr-7 重构 Request/Response
+
# 2017-11-02
+
* 重构 config 配置
* 新增 .env 配置环境信息
+
# 2017-11-01
+
* 新增定时任务
+
# 2017-10-24
+
* 协程、异步任务投递
* 自定义用户进程
* RPC, Redis, Http, Mysql 协程和同步客户端无缝切换
* HTTP 和 RPC 服务器分开管理
+
# 2017-09-19
+
* 数据库 ORM
+
# 2017-09-02
+
* 别名机制
* 事件机制
* 国际化(i18n)
* 命名空间统一大写。
+
# 2017-08-28
* 新增 Inotify 自动 Reload
+
# 2017-08-24
+
* 重写 IoC 容器
* 新增控制器路由注解注册
* 重写容器注入,不再依赖 PHP-DI
+
# 2017-08-15
+
* 重构 Console 命令行
+
# ......
From f48a659350fc1622987a82e743cf68601a33725c Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Tue, 10 Apr 2018 21:53:21 +0800
Subject: [PATCH 201/643] refactor db
---
app/Controllers/OrmController.php | 523 +++++++---------------------
app/Controllers/RedisController.php | 12 +-
app/Controllers/RpcController.php | 6 +
app/Tasks/SyncTask.php | 10 +-
4 files changed, 149 insertions(+), 402 deletions(-)
diff --git a/app/Controllers/OrmController.php b/app/Controllers/OrmController.php
index 0fd52216..281cbc92 100644
--- a/app/Controllers/OrmController.php
+++ b/app/Controllers/OrmController.php
@@ -2,7 +2,7 @@
/**
* This file is part of Swoft.
*
- * @link https://swoft.org
+ * @link https://swoft.org
* @document https://doc.swoft.org
* @contact group@swoft.org
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
@@ -12,520 +12,251 @@
use App\Models\Entity\Count;
use App\Models\Entity\User;
-use Swoft\Db\Pool;
+use Swoft\Db\Db;
+use Swoft\Db\Query;
use Swoft\Http\Server\Bean\Annotation\Controller;
-use Swoft\Db\EntityManager;
-use Swoft\Db\QueryBuilder;
-use Swoft\Db\Types;
+use Swoft\Http\Server\Bean\Annotation\RequestMapping;
/**
* @Controller()
*/
class OrmController
{
- public function arSave()
+ public function save()
{
$user = new User();
- $user->setName('stelin');
+ $user->setName('name');
$user->setSex(1);
$user->setDesc('this my desc');
$user->setAge(mt_rand(1, 100));
- $deferUser = $user->save();
- $count = new Count();
- $count->setUid(999);
- $count->setFans(mt_rand(1, 1000));
- $count->setFollows(mt_rand(1, 1000));
- $deferCount = $count->save();
+ $userId = $user->save()->getResult();
- $userResult = $deferUser->getResult();
- $countResult = $deferCount->getResult();
+ return [$userId];
+ }
- $user = new User();
- $user->setName('stelin2');
- $user->setSex(1);
- $user->setDesc('this my desc2');
- $user->setAge(mt_rand(1, 100));
- $directUser = $user->save()->getResult();
+ public function findById()
+ {
+ $result = User::findById(41710)->getResult();
+ $query = User::findById(41710);
- $count = new Count();
- $count->setUid($directUser);
- $count->setFans(mt_rand(1, 1000));
- $count->setFollows(mt_rand(1, 1000));
- $directCount = $count->save()->getResult();
+ /* @var User $user */
+ $user = $query->getResult(User::class);
- return [$userResult, $countResult, $directUser, $directCount];
+ return [$result, $user->getName()];
}
- public function test(){
- $sql = 'select * from user';
- $em = EntityManager::create();
- $result = $em->createQuery($sql)->execute()->getResult();
-// $em->close();
-
- return [$result];
+ public function selectDb(){
+ $data = [
+ 'name' => 'name',
+ 'sex' => 1,
+ 'description' => 'this my desc',
+ 'age' => mt_rand(1, 100),
+ ];
+ $result = Query::table(User::class)->selectDb('test2')->insert($data)->getResult();
+ return $result;
}
- public function notGetResult(){
-
- $user2 = User::findById(4212)->getResult();
- $user = User::findById(4212);
- return [$user2];
+ public function selectTable(){
+ $data = [
+ 'name' => 'name',
+ 'sex' => 1,
+ 'description' => 'this my desc',
+ 'age' => mt_rand(1, 100),
+ ];
+ $result = Query::table('user2')->insert($data)->getResult();
+ return $result;
}
- /**
- * @return array
- */
- public function notCommitAndClose()
+ public function transactionCommit()
{
- $user2 = User::findById(4212)->getResult();
-
+ Db::beginTransaction();
$user = new User();
- $user->setName('stelin');
+ $user->setName('name');
$user->setSex(1);
$user->setDesc('this my desc');
$user->setAge(mt_rand(1, 100));
- $em = EntityManager::create();
- $em->beginTransaction();
- $result = $em->save($user)->getResult();
+ $userId = $user->save()->getResult();
+ Db::commit();
- return [$user2, $result];
+
+ return $userId;
}
- /**
- * @return array
- */
- public function notCommitAndCloseAndGetResult()
+ public function transactionRollback()
{
- $user2 = User::findById(4212)->getResult();
+ Db::beginTransaction();
$user = new User();
- $user->setName('stelin');
+ $user->setName('name');
$user->setSex(1);
$user->setDesc('this my desc');
$user->setAge(mt_rand(1, 100));
- $em = EntityManager::create();
- $em->beginTransaction();
- $result = $em->save($user);
+ $userId = $user->save()->getResult();
- return [$user2, $result];
- }
+ $count = new Count();
+ $count->setUid($userId);
+ $count->setFollows(mt_rand(1, 100));
+ $count->setFans(mt_rand(1, 100));
- /**
- * @return array
- */
- public function notCommit()
- {
- $user2 = User::findById(4212)->getResult();
+ $countId = $count->save()->getResult();
- $user = new User();
- $user->setName('stelin');
- $user->setSex(1);
- $user->setDesc('this my desc');
- $user->setAge(mt_rand(1, 100));
+ Db::rollback();
- $em = EntityManager::create();
- $em->beginTransaction();
- $result = $em->save($user)->getResult();
- $em->close();
- return [$user2, $result];
+ return [$userId, $countId];
}
/**
- * @return array
+ * This is a wrong operation, only used to test
+ *
+ * @return mixed
*/
- public function notCloseButCommit()
+ public function transactionNotCommitOrRollback()
{
- $user2 = User::findById(4212)->getResult();
-
+ Db::beginTransaction();
$user = new User();
- $user->setName('stelin');
+ $user->setName('name');
$user->setSex(1);
$user->setDesc('this my desc');
$user->setAge(mt_rand(1, 100));
- $em = EntityManager::create();
- $em->beginTransaction();
- $result = $em->save($user)->getResult();
- $em->commit();
+ $userId = $user->save()->getResult();
+
+ // This is a wrong operation, You must to commit or rollback
+ // ...
- return [$user2, $result];
+ return $userId;
}
/**
- * @return array
+ * This is a wrong operation, only used to test
+ *
+ * @RequestMapping("tsnonr")
+ * @return mixed
*/
- public function closeAndNotGetResult()
+ public function transactionNotCommitOrRollbackAndNotGetResult()
{
+ Db::beginTransaction();
$user = new User();
- $user->setName('stelin');
+ $user->setName('name');
$user->setSex(1);
$user->setDesc('this my desc');
$user->setAge(mt_rand(1, 100));
- $em = EntityManager::create();
- $user2 = User::findById(4212)->getResult();
- $em->beginTransaction();
- $result = $em->save($user)->getResult();
- $result = $em->save($user);
- $em->commit();
- $em->close();
+ $userId = $user->save();
- return [$user2, $result];
+ // This is a wrong operation, You must to commit or rollback
+ // ...
+
+ return ['11'];
}
/**
- * EM查找
+ * This is a wrong operation, only used to test
+ *
+ * @RequestMapping("tsng")
+ * @return mixed
*/
- public function save()
+ public function transactionNotGetResult()
{
+ Db::beginTransaction();
$user = new User();
- $user->setName('stelin');
+ $user->setName('name');
$user->setSex(1);
$user->setDesc('this my desc');
$user->setAge(mt_rand(1, 100));
- $em = EntityManager::create();
- // $result = $em->save($user);
- $result = $em->save($user)->getResult();
- $em->close();
+ $userId = $user->save();
+ Db::commit();
- return [$result];
- }
-
- public function forceMater()
- {
- $user = User::findById(4212, 'default.master')->getResult();
- return [$user];
- }
-
- /**
- * 实体内容删除
- */
- public function arDelete()
- {
- $user = new User();
- // $user->setId(286);
- $user->setAge(126);
-
- // $result = $user->delete();
- $defer = $user->delete();
-
- return $defer->getResult();
+ return [333];
}
/**
- * Em 删除
+ * This is a wrong operation, only used to test
+ *
+ * @RequestMapping("tsng2")
+ * @return mixed
*/
- public function delete()
+ public function transactionNotGetResult2()
{
+ Db::beginTransaction();
$user = new User();
- $user->setId(418);
-
- $em = EntityManager::create();
- // $result = $em->delete($user);
- $result = $em->delete($user);
- $em->close();
-
- return [$result->getResult()];
- }
-
- /**
- * EM deleteId
- */
- public function deleteId()
- {
- $em = EntityManager::create();
- // $result = $em->deleteById(Count::class, 396);
- $result = $em->deleteById(Count::class, 406);
- $em->close();
- return [$result->getResult()];
- }
-
- /**
- * EM DeleteIds
- */
- public function deleteIds()
- {
- $em = EntityManager::create();
- // $result = $em->deleteByIds(Count::class, [409, 410]);
- $result = $em->deleteByIds(Count::class, [411, 412]);
- $em->close();
- return [$result->getResult()];
- }
-
- /**
- * 删除ID测试
- */
- public function arDeleteId()
- {
- // $result = User::deleteById(284);
- $result = User::deleteById(287);
-
- return $result->getResult();
- }
+ $user->setName('name');
+ $user->setSex(1);
+ $user->setDesc('this my desc');
+ $user->setAge(mt_rand(1, 100));
- /**
- * 删除IDs测试
- */
- public function arDeleteIds()
- {
- // $result = User::deleteByIds([291, 292]);
- $result = User::deleteByIds([288, 289]);
+ $userId = $user->save();
+ Db::rollback();
- return $result->getResult();
+ return [33];
}
/**
- * 更新操作
+ * This is a wrong operation, only used to test
+ *
+ * @return mixed
*/
- public function arUpdate()
+ public function notGetResult()
{
- $query = User::findById(285);
+ $result = User::findById(19362);
+ $query = User::findById(19362);
/* @var User $user */
$user = $query->getResult(User::class);
- $user->setName('upateNameUser2');
- $user->setSex(0);
-
- $result = $user->update();
- // $result = $user->update(true);
- // $result = $result->getResult();
-
- return [$result->getResult()];
- }
- /**
- * 实体查找
- */
- public function arFind()
- {
- $user = new User();
- $user->setSex(1);
- $user->setAge(93);
- $query = $user->find();
-
- $result = $query->getResult(User::class);
- return [$result];
+ return [33];
}
/**
- * EM find
+ * This is a wrong operation, only used to test
+ *
+ * @return mixed
*/
- public function find()
+ public function notGetResult2()
{
$user = new User();
+ $user->setName('name');
$user->setSex(1);
- $em = EntityManager::create();
- $query = $em->find($user);
- // $result = $query->getResult();
- // $result = $query->getResult(User::class);
- // $result = $query->getDefer()->getResult();
- $result = $query->getResult(User::class);
- $em->close();
-
- return [$result];
- }
+ $user->setDesc('this my desc');
+ $user->setAge(mt_rand(1, 100));
- /**
- * Ar ID查找
- */
- public function arFindId()
- {
- $result = User::findById(4212)->getResult();
+ $userId = $user->save()->getResult();
- $query = User::findById(4212);
+ $result = User::findById(19362);
+ $query = User::findById(19362);
/* @var User $user */
$user = $query->getResult(User::class);
- return [$result, $user->getName()];
- }
-
- /**
- * EM find id
- */
- public function findId()
- {
- $em = EntityManager::create();
- $query = $em->findById(User::class, 396);
- // $result = $query->getResult();
- // $result = $query->getResult(User::class);
- $result = $query->getResult();
- $em->close();
-
- return [$result];
- }
-
- /**
- * Ar IDS查找
- */
- public function arFindIds()
- {
- $query = User::findByIds([416, 417]);
- // $defer = $query->getDefer();
- // $result = $defer->getResult(User::class);
-
- $result = $query->getResult();
-
- return [$result];
- }
-
- /**
- * EM find ids
- */
- public function findIds()
- {
- $em = EntityManager::create();
- $query = $em->findByIds(User::class, [396, 403]);
- $result = $query->getResult();
- // $result = $query->getResult(User::class);
- // $result = $query->getDefer()->getResult(User::class);
- $em->close();
-
- return [$result];
- }
-
- /**
- * Ar Query
- */
- public function arQuery()
- {
- // $query = User::query()->select('*')->andWhere('sex', 1)->orderBy('id',QueryBuilder::ORDER_BY_DESC)->limit(3);
- // $query = User::query()->selects(['id', 'sex' => 'sex2'])->andWhere('sex', 1)->orderBy('id',QueryBuilder::ORDER_BY_DESC)->limit(3);
- $query = User::query()->selects(['id', 'sex' => 'sex2'])->leftJoin(Count::class, 'count.uid=user.id')->andWhere('id', 429)
- ->orderBy('user.id', QueryBuilder::ORDER_BY_DESC)->limit(2)->execute();
- // $result = $query->getResult();
- $result = $query->getResult();
- return [$result];
+ return [222];
}
/**
- * EM 事务测试
+ * This is a wrong operation, only used to test
+ *
+ * @return mixed
*/
- public function ts()
+ public function notGetResult3()
{
$user = new User();
- $user->setName('stelin');
+ $user->setName('name');
$user->setSex(1);
$user->setDesc('this my desc');
$user->setAge(mt_rand(1, 100));
- $user2 = new User();
- $user2->setName('stelin');
- $user2->setSex(1);
- $user2->setDesc('this my desc');
- $user2->setAge(mt_rand(1, 100));
-
- $count = new Count();
- $count->setFans(mt_rand(1, 1000));
- $count->setFollows(mt_rand(1, 1000));
-
- $em = EntityManager::create();
- $re = $user2->save()->getResult();
- $em->beginTransaction();
-
- $uid = $em->save($user)->getResult();
- $count->setUid($uid);
+ $userId = $user->save();
- $result = $em->save($count)->getResult();
+ $result = User::findById(19362);
+ $query = User::findById(19362);
- $result2 = $user2->save()->getResult();
- $em->rollback();
-// $em->commit();
- $em->close();
-
- return [$uid, $result];
- }
-
- public function query()
- {
- $em = EntityManager::create();
- $query = $em->createQuery();
- $result = $query->select('*')->from(User::class, 'u')->leftJoin(Count::class, ['u.id=c.uid'], 'c')->whereIn('u.id', [419, 420, 421])
- ->orderBy('u.id', QueryBuilder::ORDER_BY_DESC)->limit(2)->execute();
- // $result = $query->getResult();
- $result = $result->getResult();
- $em->close();
-
- return [$result];
- }
-
- /**
- * 并发执行两个语句
- */
- public function arCon()
- {
- $query1 = User::query()->selects(['id', 'sex' => 'sex2'])->leftJoin(Count::class, 'count.uid=user.id')->andWhere('id', 419)
- ->orderBy('user.id', QueryBuilder::ORDER_BY_DESC)->limit(2)->execute();
-
- $query2 = User::query()->select('*')->leftJoin(Count::class, 'count.uid=user.id')->andWhere('id', 420)
- ->orderBy('user.id', QueryBuilder::ORDER_BY_DESC)->limit(2)->execute();
-
- $result1 = $query1->getResult();
- $result2 = $query2->getResult();
- return [$result1, $result2];
- }
+ /* @var User $user */
+ $user = $query->getResult(User::class);
- public function sql()
- {
- $ids = [4212, 4213];
- $poolId = Pool::MASTER;
-
- $em = EntityManager::create($poolId);
- $result = $em->createQuery('select * from user where id in(?, ?) and name = ? order by id desc limit 2')
- ->setParameter(0, $ids[0])
- ->setParameter(1, $ids[1])
- ->setParameter(2, 'stelin')
- ->execute()->getResult();
- $em->close();
-
- $em = EntityManager::create($poolId);
- $result2 = $em->createQuery('select * from user where id in(?, ?) and name = ? order by id desc limit 2')
- ->setParameter(0, $ids[0])
- ->setParameter(1, $ids[1])
- ->setParameter(2, 'stelin', Types::STRING)
- ->execute()->getResult();
- $em->close();
-
- $em = EntityManager::create($poolId);
- $result3 = $em->createQuery('select * from user where id in(?, ?) and name = ? order by id desc limit 2')
- ->setParameters([$ids[0], $ids[1], 'stelin'])
- ->execute()->getResult();
- $em->close();
-
- $em = EntityManager::create($poolId);
- $result4 = $em->createQuery('select * from user where id in(:id1, :id2) and name = :name order by id desc limit 2')
- ->setParameter(':id1', $ids[0])
- ->setParameter('id2', $ids[1])
- ->setParameter('name', 'stelin')
- ->execute()->getResult();
- $em->close();
-
- $em = EntityManager::create($poolId);
- $result5 = $em->createQuery('select * from user where id in(:id1, :id2) and name = :name order by id desc limit 2')
- ->setParameters([
- 'id1' => $ids[0],
- ':id2' => $ids[1],
- 'name' => 'stelin'
- ])
- ->execute()->getResult();
- $em->close();
-
-
- $em = EntityManager::create($poolId);
- $result6 = $em->createQuery('select * from user where id in(:id1, :id2) and name = :name order by id desc limit 2')
- ->setParameters([
- ['id1', $ids[0]],
- [':id2', $ids[1], Types::INT],
- ['name', 'stelin', Types::STRING],
- ])
- ->execute()->getResult();
- $em->close();
-
- return [\count($result)];
+ return [33];
}
}
\ No newline at end of file
diff --git a/app/Controllers/RedisController.php b/app/Controllers/RedisController.php
index 293c1e10..f92ac9fa 100644
--- a/app/Controllers/RedisController.php
+++ b/app/Controllers/RedisController.php
@@ -81,7 +81,7 @@ public function error()
public function ab()
{
- $result1 = User::query()->select('*')->where('id', '720')->limit(1)->execute()->getResult();
+ $result1 = User::query()->where('id', '720')->limit(1)->get()->getResult();
$result2 = $this->redis->set('test1', 1);
return [$result1, $result2];
@@ -156,15 +156,21 @@ public function has()
public function testDefer()
{
$ret1 = $this->redis->deferCall('set', ['name1', 'swoft1']);
- $ret2 = $this->redis->deferCall('set', ['name2', 'swoft2']);
+// $ret2 = $this->redis->deferCall('set', ['name2', 'swoft2']);
$r1 = $ret1->getResult();
$r2 = 1;
- $r2 = $ret2->getResult();
+// $r2 = $ret2->getResult();
$ary = 1;
// $ary = $this->redis->getMultiple(['name1', 'name2']);
return [$r1, $r2, $ary];
}
+
+ public function deferError()
+ {
+ $ret1 = $this->redis->deferCall('set', ['name1', 'swoft1']);
+ return 'error';
+ }
}
\ No newline at end of file
diff --git a/app/Controllers/RpcController.php b/app/Controllers/RpcController.php
index f98a391c..f2f20905 100644
--- a/app/Controllers/RpcController.php
+++ b/app/Controllers/RpcController.php
@@ -114,6 +114,12 @@ public function defer(){
return [$result1, $result2, $result3];
}
+ public function deferError()
+ {
+ $defer1 = $this->demoService->deferGetUser('123');
+ return ['error'];
+ }
+
public function beanCall()
{
return [
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index ec68852e..4383c745 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -15,6 +15,7 @@
use Swoft\App;
use Swoft\Bean\Annotation\Inject;
use Swoft\HttpClient\Client;
+use Swoft\Redis\Redis;
use Swoft\Rpc\Client\Bean\Annotation\Reference;
use Swoft\Task\Bean\Annotation\Scheduled;
use Swoft\Task\Bean\Annotation\Task;
@@ -84,9 +85,12 @@ public function deliverAsync(string $p1, string $p2)
*/
public function cache()
{
- cache()->set('cacheKey', 'cache');
-
- return cache('cacheKey');
+ /* @var Redis $cache */
+ $cache = \Swoft\App::getBean(Redis::class);
+// $ret1 = $cache->deferCall('set', ['name1', 'swoft1'])->getResult();
+ $ret1 = $cache->deferCall('set', ['name1', 'swoft1']);
+// return cache('cacheKey');
+ return 111;
}
/**
From d8ff4f26bfd2361a53cd2ada12b8bc05a65b0c60 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Wed, 11 Apr 2018 14:35:59 +0800
Subject: [PATCH 202/643] Update Dockerfile
Upgrade swoole to v2.1.2
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index c692d568..b5c53b45 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -37,7 +37,7 @@ RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.
) \
&& rm -r hiredis
-RUN wget https://github.com/swoole/swoole-src/archive/v2.1.1.tar.gz -O swoole.tar.gz \
+RUN wget https://github.com/swoole/swoole-src/archive/v2.1.2.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
&& rm swoole.tar.gz \
From c14c08dc9f9b564046d9994a3b62364b76cddfb6 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 13 Apr 2018 11:21:34 +0800
Subject: [PATCH 203/643] add dev composer.json
---
dev.composer.json | 68 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 dev.composer.json
diff --git a/dev.composer.json b/dev.composer.json
new file mode 100644
index 00000000..984e79d2
--- /dev/null
+++ b/dev.composer.json
@@ -0,0 +1,68 @@
+{
+ "name": "swoft/swoft",
+ "type": "project",
+ "keywords": [
+ "php",
+ "swoole",
+ "swoft"
+ ],
+ "description": "Modern High performance AOP and Coroutine PHP Framework, base on Swoole 2",
+ "license": "Apache-2.0",
+ "require": {
+ "php": ">=7.0",
+ "swoft/framework": "^1.0",
+ "swoft/rpc": "^1.0",
+ "swoft/rpc-server": "^1.0",
+ "swoft/rpc-client": "^1.0",
+ "swoft/http-server": "^1.0",
+ "swoft/http-client": "^1.0",
+ "swoft/websocket-server": "^1.0",
+ "swoft/task": "^1.0",
+ "swoft/http-message": "^1.0",
+ "swoft/view": "^1.0",
+ "swoft/db": "^1.0",
+ "swoft/cache": "^1.0",
+ "swoft/redis": "^1.0",
+ "swoft/console": "^1.0",
+ "swoft/devtool": "^1.0",
+ "swoft/session": "^1.0",
+ "swoft/i18n": "^1.0",
+ "swoft/process": "^1.0",
+ "swoft/memory": "^1.0",
+ "swoft/service-governance": "^1.0",
+ "swoft/component": "dev-master as 1.0"
+ },
+ "require-dev": {
+ "eaglewu/swoole-ide-helper": "dev-master",
+ "phpunit/phpunit": "^5.7"
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "app/"
+ },
+ "files": [
+ "app/Swoft.php"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Swoft\\Test\\": "test/"
+ }
+ },
+ "scripts": {
+ "post-root-package-install": [
+ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
+ ],
+ "test": "./vendor/bin/phpunit -c phpunit.xml"
+ },
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-component"
+ },
+ {
+ "type": "composer",
+ "url": "https://packagist.phpcomposer.com/"
+ }
+ ]
+}
From b25db1d4fcd7221ae55a1d727ba68404af3c33f5 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Sun, 15 Apr 2018 02:09:12 +0800
Subject: [PATCH 204/643] Update Dockerfile
Upgrade swoole to v2.1.3
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index b5c53b45..01b3602e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -37,7 +37,7 @@ RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.
) \
&& rm -r hiredis
-RUN wget https://github.com/swoole/swoole-src/archive/v2.1.2.tar.gz -O swoole.tar.gz \
+RUN wget https://github.com/swoole/swoole-src/archive/v2.1.3.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
&& rm swoole.tar.gz \
From 169ce33d5558ccf0a33a8010782228516fcbfb4e Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Sun, 15 Apr 2018 03:33:43 +0800
Subject: [PATCH 205/643] Add English version README.md
---
README-EN.md | 210 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 210 insertions(+)
create mode 100644 README-EN.md
diff --git a/README-EN.md b/README-EN.md
new file mode 100644
index 00000000..7fd35c44
--- /dev/null
+++ b/README-EN.md
@@ -0,0 +1,210 @@
+
+
+
+
+
+
+[](https://github.com/swoft-cloud/swoft/releases)
+[](https://travis-ci.org/swoft-cloud/swoft)
+[](https://secure.php.net/)
+[](https://github.com/swoole/swoole-src)
+[](https://github.com/redis/hiredis)
+[](https://doc.swoft.org)
+[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
+
+
+# Introduction
+The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, standard PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
+
+- Base on Swoole extension
+- Built-in HTTP, TCP, WebSocket Server
+- Poweful AOP (Aspect Oriented Programming)
+- Flexible and comprehensive annotations framework
+- Global dependency injection container
+- PSR-7 based HTTP message implementation
+- PSR-14 based event manager
+- PSR-15 based middleware
+- PSR-16 based cache design
+- Scalable high performance RPC
+- Great service governance, fallback, load balance, service registration and discovery
+- Database ORM
+- Universal connection pool
+- Mysql, Redis, RPC, HTTP Coroutine Clients
+- Coroutine driver client and blocking driver client seamlessly switch automatically
+- Coroutine and asynchronous task delivery
+- Custom user process
+- RESTful support
+- Internationalization (i18n) support
+- High performance router
+- Fast and flexible parameter validator
+- Alias mechanism
+- Powerful log component
+- Cross-platform application auto-reload
+
+
+# Document
+[**Chinese Document**](https://doc.swoft.org)
+[**English Document**](https://doc.swoft.org) Not yet, please help us write it.
+
+QQ Group: 548173319
+
+# Environmental Requirements
+
+1. PHP 7.0 +
+2. [Swoole 2.1.1](https://github.com/swoole/swoole-src/releases) +, *coroutine* and *async redis client* options are required
+3. [Hiredis](https://github.com/redis/hiredis/releases)
+4. [Composer](https://getcomposer.org/)
+
+# Install
+
+## Manual Installation
+
+* Clone project
+* Install requires `composer install`
+
+## Install by Composer
+
+* `composer create-project swoft/swoft swoft`
+
+## Install by Docker
+
+* `docker run -p 80:80 swoft/swoft`
+
+## Install by Docker-Compose
+
+* `cd swoft`
+* `docker-compose up`
+
+# Configuration
+
+If automatically copy `.env` file fails when `composer install` is executed, the `.env.example` that in root directory can be manually copied and named `.env`. Note that when `composer update` is executed will not trigger related copy operations
+
+```
+# Server
+PFILE=/tmp/swoft.pid
+PNAME=php-swoft
+TCPABLE=true
+CRONABLE=false
+AUTO_RELOAD=true
+
+# HTTP
+HTTP_HOST=0.0.0.0
+HTTP_PORT=80
+
+# WebSocket
+WS_ENABLE_HTTP=true
+
+# TCP
+TCP_HOST=0.0.0.0
+TCP_PORT=8099
+TCP_PACKAGE_MAX_LENGTH=2048
+TCP_OPEN_EOF_CHECK=false
+
+# Crontab
+CRONTAB_TASK_COUNT=1024
+CRONTAB_TASK_QUEUE=2048
+
+# Settings
+WORKER_NUM=1
+MAX_REQUEST=10000
+DAEMONIZE=0
+DISPATCH_MODE=2
+LOG_FILE=@runtime/swoole.log
+TASK_WORKER_NUM=1
+```
+
+## Management
+
+### Help command
+
+```text
+[root@swoft]# php bin/swoft -h
+ ____ __ _
+/ ___|_ _____ / _| |_
+\___ \ \ /\ / / _ \| |_| __|
+ ___) \ V V / (_) | _| |_
+|____/ \_/\_/ \___/|_| \__|
+
+Usage:
+ php bin/swoft {command} [arguments ...] [options ...]
+
+Commands:
+ entity The group command list of database entity
+ gen Generate some common application template classes
+ rpc The group command list of rpc server
+ server The group command list of http-server
+ ws There some commands for manage the webSocket server
+
+Options:
+ -v, --version show version
+ -h, --help show help
+```
+
+## Start HTTP Server
+
+```bash
+// Start HTTP Server
+php bin/swoft start
+
+// Start Daemonize HTTP Server
+php bin/swoft start -d
+
+// Restart HTTP server
+php bin/swoft restart
+
+// Reload HTTP server
+php bin/swoft reload
+
+// Stop HTTP server
+php bin/swoft stop
+```
+
+### Start WebSocket Server
+
+Start WebSocket Server, optional whether to support http processing
+
+```bash
+// Star WebSocket Server
+php bin/swoft ws:start
+
+// Start Daemonize WebSocket Server
+php bin/swoft ws:start -d
+
+// Restart WebSocket server
+php bin/swoft ws:restart
+
+// Reload WebSocket server
+php bin/swoft ws:reload
+
+// Stop WebSocket server
+php bin/swoft ws:stop
+```
+
+## Start RPC Server
+
+> Start an independent RPC Server
+
+```bash
+// Start RPC Server
+php bin/swoft rpc:start
+
+// Start Daemonize RPC Server
+php bin/swoft rpc:start -d
+
+// Restart RPC Server
+php bin/swoft rpc:restart
+
+// Reload RPC Server
+php bin/swoft rpc:reload
+
+// Stop RPC Server
+php bin/swoft rpc:stop
+
+```
+
+# Changelog
+
+[Changelog](changelog.md)
+
+# License
+Swoft is open-source software licensed under the [LICENSE](LICENSE)
From d64161f050f0486594e38c42a6cd53db4685a97c Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Sun, 15 Apr 2018 03:34:11 +0800
Subject: [PATCH 206/643] Update Swoole extension version requires
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index c3841458..a7857619 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
[](https://github.com/swoft-cloud/swoft/releases)
[](https://travis-ci.org/swoft-cloud/swoft)
[](https://secure.php.net/)
-[](https://github.com/swoole/swoole-src)
+[](https://github.com/swoole/swoole-src)
[](https://github.com/redis/hiredis)
[](https://doc.swoft.org)
[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
From ac24070606efc99b0958ad3f3500a6e952f3305d Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Sun, 15 Apr 2018 03:36:35 +0800
Subject: [PATCH 207/643] Update README-EN.md
---
README-EN.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README-EN.md b/README-EN.md
index 7fd35c44..b4e0008f 100644
--- a/README-EN.md
+++ b/README-EN.md
@@ -14,7 +14,7 @@
# Introduction
-The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, standard PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
+The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, standard PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
- Base on Swoole extension
- Built-in HTTP, TCP, WebSocket Server
From 32c63312a05b8a07e17eb86f368427e11e59ac6f Mon Sep 17 00:00:00 2001
From: Inhere
Date: Sun, 15 Apr 2018 09:17:56 +0800
Subject: [PATCH 208/643] Update README-EN.md
---
README-EN.md | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/README-EN.md b/README-EN.md
index b4e0008f..4574ff03 100644
--- a/README-EN.md
+++ b/README-EN.md
@@ -12,8 +12,8 @@
[](https://doc.swoft.org)
[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
+## Introduction
-# Introduction
The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, standard PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
- Base on Swoole extension
@@ -42,40 +42,41 @@ The first high-performance PHP coroutine full-stack componentization framework b
- Cross-platform application auto-reload
-# Document
+## Document
+
[**Chinese Document**](https://doc.swoft.org)
[**English Document**](https://doc.swoft.org) Not yet, please help us write it.
QQ Group: 548173319
-# Environmental Requirements
+## Environmental Requirements
1. PHP 7.0 +
2. [Swoole 2.1.1](https://github.com/swoole/swoole-src/releases) +, *coroutine* and *async redis client* options are required
3. [Hiredis](https://github.com/redis/hiredis/releases)
4. [Composer](https://getcomposer.org/)
-# Install
+## Install
-## Manual Installation
+### Manual Installation
* Clone project
* Install requires `composer install`
-## Install by Composer
+### Install by Composer
* `composer create-project swoft/swoft swoft`
-## Install by Docker
+### Install by Docker
* `docker run -p 80:80 swoft/swoft`
-## Install by Docker-Compose
+### Install by Docker-Compose
* `cd swoft`
* `docker-compose up`
-# Configuration
+## Configuration
If automatically copy `.env` file fails when `composer install` is executed, the `.env.example` that in root directory can be manually copied and named `.env`. Note that when `composer update` is executed will not trigger related copy operations
@@ -140,7 +141,7 @@ Options:
-h, --help show help
```
-## Start HTTP Server
+### Start HTTP Server
```bash
// Start HTTP Server
@@ -180,7 +181,7 @@ php bin/swoft ws:reload
php bin/swoft ws:stop
```
-## Start RPC Server
+### Start RPC Server
> Start an independent RPC Server
@@ -199,12 +200,12 @@ php bin/swoft rpc:reload
// Stop RPC Server
php bin/swoft rpc:stop
-
```
-# Changelog
+## Changelog
[Changelog](changelog.md)
-# License
+## License
+
Swoft is open-source software licensed under the [LICENSE](LICENSE)
From 12e0685191d560214eca2bb64a3ddc39d3d22d62 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Sun, 15 Apr 2018 09:19:45 +0800
Subject: [PATCH 209/643] Update README.md
---
README.md | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index a7857619..3ca8fc33 100644
--- a/README.md
+++ b/README.md
@@ -12,8 +12,8 @@
[](https://doc.swoft.org)
[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
+## 简介
-# 简介
首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈组件化框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的 PHP-FPM,全异步非阻塞 IO 实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield,有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
- 基于 Swoole 扩展
@@ -42,39 +42,40 @@
- 跨平台热更新自动 Reload
-# 文档
+## 文档
+
[**中文文档**](https://doc.swoft.org)
QQ 交流群: 548173319
-# 环境要求
+## 环境要求
1. PHP 7.0 +
2. [Swoole 2.1.1](https://github.com/swoole/swoole-src/releases) +, 需开启协程和异步Redis
3. [Hiredis](https://github.com/redis/hiredis/releases)
4. [Composer](https://getcomposer.org/)
-# 安装
+## 安装
-## 手动安装
+### 手动安装
* Clone 项目
* 安装依赖 `composer install`
-## Composer 安装
+### Composer 安装
* `composer create-project swoft/swoft swoft`
-## Docker 安装
+### Docker 安装
* `docker run -p 80:80 swoft/swoft`
-## Docker-Compose 安装
+### Docker-Compose 安装
* `cd swoft`
* `docker-compose up`
-# 配置
+## 配置
若在执行 `composer install` 的时候由程序自动复制环境变量配置文件失败,则可手动复制项目根目录的 `.env.example` 并命名为 `.env`,注意在执行 `composer update` 时并不会触发相关的复制操作
@@ -139,7 +140,7 @@ Options:
-h, --help show help
```
-## HTTP Server启动
+### HTTP Server启动
> 是否同时启动RPC服务器取决于.env文件配置
@@ -181,7 +182,7 @@ php bin/swoft ws:reload
php bin/swoft ws:stop
```
-## RPC Server启动
+### RPC Server启动
> 启动独立的RPC服务器
@@ -200,12 +201,12 @@ php bin/swoft rpc:reload
// 关闭服务
php bin/swoft rpc:stop
-
```
-# 更新日志
+## 更新日志
[更新日志](changelog.md)
-# 协议
+## 协议
+
Swoft 的开源协议为 Apache-2.0,详情参见[LICENSE](LICENSE)
From 37af822a1f6071d70329404d9d30596fbe1e64fb Mon Sep 17 00:00:00 2001
From: Inhere
Date: Sun, 15 Apr 2018 10:43:46 +0800
Subject: [PATCH 210/643] add timezone
---
.env.example | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.env.example b/.env.example
index 3a69ebb9..452e9b0d 100644
--- a/.env.example
+++ b/.env.example
@@ -1,3 +1,6 @@
+# Application
+TIME_ZONE=Asia/Shanghai
+
# Server
PFILE=/tmp/swoft.pid
PNAME=php-swoft
From 02d51dcc38d918af0ba71364808eb60c15caf74b Mon Sep 17 00:00:00 2001
From: Inhere
Date: Sun, 15 Apr 2018 11:10:03 +0800
Subject: [PATCH 211/643] Update and rename README.md to README_CN.md
---
README.md => README_CN.md | 2 ++
1 file changed, 2 insertions(+)
rename README.md => README_CN.md (99%)
diff --git a/README.md b/README_CN.md
similarity index 99%
rename from README.md
rename to README_CN.md
index 3ca8fc33..31f7565d 100644
--- a/README.md
+++ b/README_CN.md
@@ -12,6 +12,8 @@
[](https://doc.swoft.org)
[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
+**[English](README.md)**
+
## 简介
首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈组件化框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的 PHP-FPM,全异步非阻塞 IO 实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield,有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
From 0dc576c2efa6873f56dd1d17d420895d7655d376 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Sun, 15 Apr 2018 11:10:57 +0800
Subject: [PATCH 212/643] Update and rename README-EN.md to README.md
---
README-EN.md => README.md | 2 ++
1 file changed, 2 insertions(+)
rename README-EN.md => README.md (99%)
diff --git a/README-EN.md b/README.md
similarity index 99%
rename from README-EN.md
rename to README.md
index 4574ff03..8261f97b 100644
--- a/README-EN.md
+++ b/README.md
@@ -12,6 +12,8 @@
[](https://doc.swoft.org)
[](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)
+**[中文说明](README_CN.md)**
+
## Introduction
The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, standard PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
From 39570750ed97693326d5ba408cf0aa01d75029ef Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Sun, 15 Apr 2018 17:59:49 +0800
Subject: [PATCH 213/643] Update README.md
---
README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 8261f97b..bb56481e 100644
--- a/README.md
+++ b/README.md
@@ -80,7 +80,7 @@ QQ Group: 548173319
## Configuration
-If automatically copy `.env` file fails when `composer install` is executed, the `.env.example` that in root directory can be manually copied and named `.env`. Note that when `composer update` is executed will not trigger related copy operations
+If automatically copied `.env` file fails when `composer install` was executed, the `.env.example` that in root directory can be manually copied and named `.env`. Note that `composer update` will not trigger related copy operations.
```
# Server
@@ -164,7 +164,7 @@ php bin/swoft stop
### Start WebSocket Server
-Start WebSocket Server, optional whether to support http processing
+Start WebSocket Server, optional whether to support HTTP processing.
```bash
// Star WebSocket Server
@@ -185,7 +185,7 @@ php bin/swoft ws:stop
### Start RPC Server
-> Start an independent RPC Server
+Start an independent RPC Server.
```bash
// Start RPC Server
@@ -210,4 +210,4 @@ php bin/swoft rpc:stop
## License
-Swoft is open-source software licensed under the [LICENSE](LICENSE)
+Swoft is an open-source software licensed under the [LICENSE](LICENSE)
From 22791b8e4e48e22ca8769610d20d07df8c204917 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Tue, 17 Apr 2018 19:17:40 +0800
Subject: [PATCH 214/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index bb56481e..29f11c95 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ QQ Group: 548173319
## Environmental Requirements
1. PHP 7.0 +
-2. [Swoole 2.1.1](https://github.com/swoole/swoole-src/releases) +, *coroutine* and *async redis client* options are required
+2. [Swoole 2.1.3](https://github.com/swoole/swoole-src/releases) +, *coroutine* and *async redis client* options are required
3. [Hiredis](https://github.com/redis/hiredis/releases)
4. [Composer](https://getcomposer.org/)
From 557d1e0f32927dfa2cf9f29d3354f88f6231e0bb Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Tue, 17 Apr 2018 19:18:01 +0800
Subject: [PATCH 215/643] Update README_CN.md
---
README_CN.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README_CN.md b/README_CN.md
index 31f7565d..99bf2d1c 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -53,7 +53,7 @@ QQ 交流群: 548173319
## 环境要求
1. PHP 7.0 +
-2. [Swoole 2.1.1](https://github.com/swoole/swoole-src/releases) +, 需开启协程和异步Redis
+2. [Swoole 2.1.3](https://github.com/swoole/swoole-src/releases) +, 需开启协程和异步Redis
3. [Hiredis](https://github.com/redis/hiredis/releases)
4. [Composer](https://getcomposer.org/)
From b81c7822973a9329304084290ca7718ae5f90780 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 18 Apr 2018 10:49:34 +0800
Subject: [PATCH 216/643] add LOG_ENABLE in .env.example
---
.env.example | 1 +
1 file changed, 1 insertion(+)
diff --git a/.env.example b/.env.example
index 452e9b0d..233868b6 100644
--- a/.env.example
+++ b/.env.example
@@ -1,5 +1,6 @@
# Application
TIME_ZONE=Asia/Shanghai
+LOG_ENABLE=false
# Server
PFILE=/tmp/swoft.pid
From bfb84a3ca8fd6fb49124efde3f055d3c095e6eb0 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 18 Apr 2018 10:53:53 +0800
Subject: [PATCH 217/643] can enable logging through .env
---
config/beans/log.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/config/beans/log.php b/config/beans/log.php
index 732e5e06..06cac847 100644
--- a/config/beans/log.php
+++ b/config/beans/log.php
@@ -1,5 +1,4 @@
@@ -30,7 +29,7 @@
],
'logger' => [
'name' => APP_NAME,
- 'enable' => false,
+ 'enable' => env('LOG_ENABLE', false),
'flushInterval' => 100,
'flushRequest' => true,
'handlers' => [
From 5338f0d9719c21ee228dadfcd35780882a36be89 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Thu, 19 Apr 2018 09:47:08 +0800
Subject: [PATCH 218/643] Create CONTRIBUTING.md
---
CONTRIBUTING.md | 1 +
1 file changed, 1 insertion(+)
create mode 100644 CONTRIBUTING.md
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..854139a3
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1 @@
+# Contributing
From 3a18191104b4c56f0f5ba629ab7bb5ff3e2858cc Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Thu, 19 Apr 2018 12:33:13 +0800
Subject: [PATCH 219/643] add CODE_OF_CONDUCT.md
---
.github/CODE_OF_CONDUCT.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 .github/CODE_OF_CONDUCT.md
diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..c2a23273
--- /dev/null
+++ b/.github/CODE_OF_CONDUCT.md
@@ -0,0 +1,12 @@
+Contributor Code of Conduct
+As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
+
+We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
+
+Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
+
+This Code of Conduct is adapted from the Contributor Covenant, version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/
\ No newline at end of file
From ff8ef812d7265f82c33d28b6056fb4246773606b Mon Sep 17 00:00:00 2001
From: huangzhhui
Date: Thu, 19 Apr 2018 12:33:22 +0800
Subject: [PATCH 220/643] add CONTRIBUTING.md
---
CONTRIBUTING.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 854139a3..432fa5e0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1 +1,46 @@
-# Contributing
+# Swoft Contributing Guide
+
+Hi! I am really excited that you are interested in contributing to Swoft. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
+
+- [Code of Conduct](./.github/CODE_OF_CONDUCT.md)
+- [Issue Reporting Guidelines](#issue-reporting-guidelines)
+- [Pull Request Guidelines](#pull-request-guidelines)
+- [Development Guidelines](#development-guidelines)
+
+## Issue Reporting Guidelines
+
+- Should always create an new issues by Github issue template, to avoid missing information.
+
+## Pull Request Guidelines
+
+The master branch is the latest stable release, the feature branch commonly is the next feature upgrade version. If it's a feature develoment, should be done in feature branch, if it's a bug-fix develoment, then you could done in master branch, or feature branch, the different between master branch an feature branch is that the feature branch will merge to master branch until next version upgraded, and master branch could release a bug-fix version anytime.
+
+Note that Swoft using [swoft-component](https://github.com/swoft-cloud/swoft-component) repository to centralized manage all Swoft components, if you want to submit an PR for component of swoft, then you should submit your PR to [swoft-component](https://github.com/swoft-cloud/swoft-component) repository.
+
+Checkout a topic branch from the relevant branch, e.g. feature, and merge back against that branch.
+
+It's OK to have multiple small commits as you work on the PR - we will let GitHub automatically squash it before merging.
+
+Make sure unit test passes, commonly you could use `composer test` to run all unit testes. (see development setup)
+
+If adding new feature:
+
+Add accompanying test case.
+Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.
+If fixing a bug:
+
+If you are resolving a special issue, add (fix #xxxx[,#xxx]) (#xxxx is the issue id) in your PR title for a better release log, e.g. update entities encoding/decoding (fix #3899).
+Provide detailed description of the bug in the PR. Live demo preferred.
+Add appropriate test coverage if applicable.
+
+## Development Guidelines
+
+Because Swoft using [swoft-component](https://github.com/swoft-cloud/swoft-component) repository to centralized manage all Swoft components, then you should add `swoft/component` requires to `composer.json` if you are developing in swoft forked repository, after this, component of swoft-component will replace all original components requires, see [Composer replace schema](https://getcomposer.org/doc/04-schema.md#replace) for more details.
+
+composer requires e.g.
+
+```json
+"require": {
+ "swoft/component": "dev-master as 1.0"
+},
+```
\ No newline at end of file
From dd2c2dcddfa9fc018bfe650c0b970d06af35d784 Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Thu, 19 Apr 2018 12:35:06 +0800
Subject: [PATCH 221/643] Update CONTRIBUTING.md
---
CONTRIBUTING.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 432fa5e0..1c77a503 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -35,7 +35,7 @@ Add appropriate test coverage if applicable.
## Development Guidelines
-Because Swoft using [swoft-component](https://github.com/swoft-cloud/swoft-component) repository to centralized manage all Swoft components, then you should add `swoft/component` requires to `composer.json` if you are developing in swoft forked repository, after this, component of swoft-component will replace all original components requires, see [Composer replace schema](https://getcomposer.org/doc/04-schema.md#replace) for more details.
+Because Swoft using [swoft-component](https://github.com/swoft-cloud/swoft-component) repository to centralized manage all Swoft components, then you should add `swoft/component` requires to `composer.json` if you are developing in swoft forked repository, after this, components of swoft-component will replace all original components requires, see [Composer replace schema](https://getcomposer.org/doc/04-schema.md#replace) for more details.
composer requires e.g.
@@ -43,4 +43,4 @@ composer requires e.g.
"require": {
"swoft/component": "dev-master as 1.0"
},
-```
\ No newline at end of file
+```
From 1e718330ca9d778002f28d14df8e93c6ae7b2f2f Mon Sep 17 00:00:00 2001
From: Huangzhhui
Date: Sun, 22 Apr 2018 01:11:11 +0800
Subject: [PATCH 222/643] Update README.md
Remove useless word
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 29f11c95..26aae8c7 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
## Introduction
-The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, standard PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
+The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
- Base on Swoole extension
- Built-in HTTP, TCP, WebSocket Server
From b3004dc3cd33cb59c9ff805d20795c66313f371e Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Sun, 22 Apr 2018 23:32:00 +0800
Subject: [PATCH 223/643] Update .travis.yml
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index a714a299..ab30c4bf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ php:
install:
- wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.gz && mkdir -p hiredis && tar -xf hiredis.tar.gz -C hiredis --strip-components=1 && cd hiredis && sudo make -j$(nproc) && sudo make install && sudo ldconfig && cd ..
- - pecl install -f swoole-2.0.12
+ - pecl install -f swoole-2.1.3
before_script:
- composer update --dev
From 68d2263e39bc3e0e16f3ea1e7b327a001418a9a6 Mon Sep 17 00:00:00 2001
From: twosee
Date: Wed, 25 Apr 2018 10:14:57 +0800
Subject: [PATCH 224/643] Fix the pecl installation.
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index ab30c4bf..e54460c7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ php:
install:
- wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.gz && mkdir -p hiredis && tar -xf hiredis.tar.gz -C hiredis --strip-components=1 && cd hiredis && sudo make -j$(nproc) && sudo make install && sudo ldconfig && cd ..
- - pecl install -f swoole-2.1.3
+ - printf "\n" | pecl install -f swoole-2.1.3
before_script:
- composer update --dev
From eafe92c32ae84d253f191cf39e75ad6b8cd29135 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 27 Apr 2018 14:35:46 +0800
Subject: [PATCH 225/643] Set task mode
---
.env.example | 2 +-
app/Controllers/DemoController.php | 14 --------------
app/Controllers/TaskController.php | 16 ++++++++++++++++
app/Tasks/SyncTask.php | 5 +++++
composer.json | 13 +++++++++----
config/beans/log.php | 2 +-
config/server.php | 2 +-
7 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/.env.example b/.env.example
index 3a69ebb9..7b072e83 100644
--- a/.env.example
+++ b/.env.example
@@ -32,7 +32,7 @@ WORKER_NUM=1
MAX_REQUEST=100000
DAEMONIZE=0
DISPATCH_MODE=2
-TASK_IPC_MODE=2
+TASK_IPC_MODE=1
MESSAGE_QUEUE_KEY=1879052289
TASK_TMPDIR=/tmp/
LOG_FILE=@runtime/logs/swoole.log
diff --git a/app/Controllers/DemoController.php b/app/Controllers/DemoController.php
index fb4f86bf..6aef0fc6 100644
--- a/app/Controllers/DemoController.php
+++ b/app/Controllers/DemoController.php
@@ -99,20 +99,6 @@ public function index2()
return 'success';
}
- /**
- * 没有使用注解,自动解析注入,默认支持get和post
- */
- public function task()
- {
- $result = Task::deliver('test', 'corTask', ['params1', 'params2'], Task::TYPE_CO);
- $mysql = Task::deliver('test', 'testMysql', [], Task::TYPE_CO);
- $http = Task::deliver('test', 'testHttp', [], Task::TYPE_CO, 20);
- $rpc = Task::deliver('test', 'testRpc', [], Task::TYPE_CO, 5);
- $result1 = Task::deliver('test', 'asyncTask', [], Task::TYPE_ASYNC);
-
- return [$rpc, $http, $mysql, $result, $result1];
- }
-
public function index6()
{
throw new Exception('AAAA');
diff --git a/app/Controllers/TaskController.php b/app/Controllers/TaskController.php
index 0fc61779..e8d1c982 100644
--- a/app/Controllers/TaskController.php
+++ b/app/Controllers/TaskController.php
@@ -18,6 +18,22 @@
*/
class TaskController
{
+ /**
+ * @return array
+ */
+ public function batch()
+ {
+ $count = 0;
+ $result = [];
+ while ($count < 10000){
+ $result[] = Task::deliver('sync', 'batchTask', [], Task::TYPE_ASYNC);
+ $count++;
+ }
+
+ return $result;
+ }
+
+
/**
* Deliver co task
*
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index 4383c745..8e187c7a 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -156,6 +156,11 @@ public function rpc2()
return $this->logic->rpcCall();
}
+ public function batchTask(){
+ sleep(mt_rand(1, 2));
+ return 'batchTask';
+ }
+
/**
* crontab定时任务
* 每一秒执行一次
diff --git a/composer.json b/composer.json
index c73590b8..984e79d2 100644
--- a/composer.json
+++ b/composer.json
@@ -29,7 +29,8 @@
"swoft/i18n": "^1.0",
"swoft/process": "^1.0",
"swoft/memory": "^1.0",
- "swoft/service-governance": "^1.0"
+ "swoft/service-governance": "^1.0",
+ "swoft/component": "dev-master as 1.0"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
@@ -54,10 +55,14 @@
],
"test": "./vendor/bin/phpunit -c phpunit.xml"
},
- "repositories": {
- "packagist": {
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-component"
+ },
+ {
"type": "composer",
"url": "https://packagist.phpcomposer.com/"
}
- }
+ ]
}
diff --git a/config/beans/log.php b/config/beans/log.php
index 732e5e06..33ba6e33 100644
--- a/config/beans/log.php
+++ b/config/beans/log.php
@@ -30,7 +30,7 @@
],
'logger' => [
'name' => APP_NAME,
- 'enable' => false,
+ 'enable' => true,
'flushInterval' => 100,
'flushRequest' => true,
'handlers' => [
diff --git a/config/server.php b/config/server.php
index 8fab6ea3..c0dd2b19 100644
--- a/config/server.php
+++ b/config/server.php
@@ -53,7 +53,7 @@
'open_http2_protocol' => env('OPEN_HTTP2_PROTOCOL', false),
'ssl_cert_file' => env('SSL_CERT_FILE', ''),
'ssl_key_file' => env('SSL_KEY_FILE', ''),
- 'task_ipc_mode' => env('TASK_IPC_MODE', 2),
+ 'task_ipc_mode' => env('TASK_IPC_MODE', 1),
'message_queue_key' => env('MESSAGE_QUEUE_KEY', 0x70001001),
'task_tmpdir' => env('TASK_TMPDIR', '/tmp'),
],
From 405599fdf48205bf465dfd5d9a3dc33468c31caa Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 27 Apr 2018 14:42:10 +0800
Subject: [PATCH 226/643] reset composer.json
---
composer.json | 123 ++++++++++++++++++++++++--------------------------
1 file changed, 59 insertions(+), 64 deletions(-)
diff --git a/composer.json b/composer.json
index 984e79d2..80daea5c 100644
--- a/composer.json
+++ b/composer.json
@@ -1,68 +1,63 @@
{
- "name": "swoft/swoft",
- "type": "project",
- "keywords": [
- "php",
- "swoole",
- "swoft"
- ],
- "description": "Modern High performance AOP and Coroutine PHP Framework, base on Swoole 2",
- "license": "Apache-2.0",
- "require": {
- "php": ">=7.0",
- "swoft/framework": "^1.0",
- "swoft/rpc": "^1.0",
- "swoft/rpc-server": "^1.0",
- "swoft/rpc-client": "^1.0",
- "swoft/http-server": "^1.0",
- "swoft/http-client": "^1.0",
- "swoft/websocket-server": "^1.0",
- "swoft/task": "^1.0",
- "swoft/http-message": "^1.0",
- "swoft/view": "^1.0",
- "swoft/db": "^1.0",
- "swoft/cache": "^1.0",
- "swoft/redis": "^1.0",
- "swoft/console": "^1.0",
- "swoft/devtool": "^1.0",
- "swoft/session": "^1.0",
- "swoft/i18n": "^1.0",
- "swoft/process": "^1.0",
- "swoft/memory": "^1.0",
- "swoft/service-governance": "^1.0",
- "swoft/component": "dev-master as 1.0"
- },
- "require-dev": {
- "eaglewu/swoole-ide-helper": "dev-master",
- "phpunit/phpunit": "^5.7"
- },
- "autoload": {
- "psr-4": {
- "App\\": "app/"
- },
- "files": [
- "app/Swoft.php"
- ]
+ "name": "swoft/swoft",
+ "type": "project",
+ "keywords": [
+ "php",
+ "swoole",
+ "swoft"
+ ],
+ "description": "Modern High performance AOP and Coroutine PHP Framework, base on Swoole 2",
+ "license": "Apache-2.0",
+ "require": {
+ "php": ">=7.0",
+ "swoft/framework": "^1.0",
+ "swoft/rpc": "^1.0",
+ "swoft/rpc-server": "^1.0",
+ "swoft/rpc-client": "^1.0",
+ "swoft/http-server": "^1.0",
+ "swoft/http-client": "^1.0",
+ "swoft/websocket-server": "^1.0",
+ "swoft/task": "^1.0",
+ "swoft/http-message": "^1.0",
+ "swoft/view": "^1.0",
+ "swoft/db": "^1.0",
+ "swoft/cache": "^1.0",
+ "swoft/redis": "^1.0",
+ "swoft/console": "^1.0",
+ "swoft/devtool": "^1.0",
+ "swoft/session": "^1.0",
+ "swoft/i18n": "^1.0",
+ "swoft/process": "^1.0",
+ "swoft/memory": "^1.0",
+ "swoft/service-governance": "^1.0"
+ },
+ "require-dev": {
+ "eaglewu/swoole-ide-helper": "dev-master",
+ "phpunit/phpunit": "^5.7"
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "app/"
},
- "autoload-dev": {
- "psr-4": {
- "Swoft\\Test\\": "test/"
- }
- },
- "scripts": {
- "post-root-package-install": [
- "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
- ],
- "test": "./vendor/bin/phpunit -c phpunit.xml"
- },
- "repositories": [
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-component"
- },
- {
- "type": "composer",
- "url": "https://packagist.phpcomposer.com/"
- }
+ "files": [
+ "app/Swoft.php"
]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Swoft\\Test\\": "test/"
+ }
+ },
+ "scripts": {
+ "post-root-package-install": [
+ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
+ ],
+ "test": "./vendor/bin/phpunit -c phpunit.xml"
+ },
+ "repositories": {
+ "packagist": {
+ "type": "composer",
+ "url": "https://packagist.phpcomposer.com/"
+ }
+ }
}
From 3c8a883c7e168a77e35896cd7c65f4cf24e62fc6 Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Fri, 27 Apr 2018 23:49:15 +0800
Subject: [PATCH 227/643] add template of validator
---
app/Controllers/TaskController.php | 2 +-
app/Controllers/ValidatorController.php | 50 +++++++++++++++++++++++++
app/Tasks/SyncTask.php | 5 ++-
test/Cases/ValidatorControllerTest.php | 17 ++++++++-
4 files changed, 71 insertions(+), 3 deletions(-)
diff --git a/app/Controllers/TaskController.php b/app/Controllers/TaskController.php
index e8d1c982..a0a46dfc 100644
--- a/app/Controllers/TaskController.php
+++ b/app/Controllers/TaskController.php
@@ -25,7 +25,7 @@ public function batch()
{
$count = 0;
$result = [];
- while ($count < 10000){
+ while ($count < 50000){
$result[] = Task::deliver('sync', 'batchTask', [], Task::TYPE_ASYNC);
$count++;
}
diff --git a/app/Controllers/ValidatorController.php b/app/Controllers/ValidatorController.php
index 124ac93c..078e0d5c 100644
--- a/app/Controllers/ValidatorController.php
+++ b/app/Controllers/ValidatorController.php
@@ -45,6 +45,16 @@ public function string(Request $request, string $name)
return [$getName, $postName, $name];
}
+ /**
+ * @RequestMapping("stringTpl")
+ * @Strings(from=ValidatorFrom::GET, name="name", min=3, max=10, template="{name}-{min}-{max} must")
+ * @return string
+ */
+ public function stringTpl()
+ {
+ return 'stringTpl';
+ }
+
/**
* @RequestMapping("number/{id}")
*
@@ -65,6 +75,16 @@ public function number(Request $request, int $id)
return [$get, $post, $id];
}
+ /**
+ * @RequestMapping("numberTpl")
+ * @Number(from=ValidatorFrom::GET, name="id", min=5, max=10, template="{name}-{min}-{max} must")
+ * @return string
+ */
+ public function numberTpl()
+ {
+ return 'numberTpl';
+ }
+
/**
* @RequestMapping("integer/{id}")
*
@@ -85,6 +105,16 @@ public function integer(Request $request, int $id)
return [$get, $post, $id];
}
+ /**
+ * @RequestMapping("integerTpl")
+ * @Integer(from=ValidatorFrom::GET, name="id", min=5, max=10, template="{name}-{min}-{max} must")
+ * @return string
+ */
+ public function integerTpl()
+ {
+ return 'integerTpl';
+ }
+
/**
* @RequestMapping("float/{id}")
*
@@ -105,6 +135,16 @@ public function float(Request $request, float $id)
return [$get, $post, $id];
}
+ /**
+ * @RequestMapping("floatTpl")
+ * @Floats(from=ValidatorFrom::GET, name="id", min=5.1, max=5.9, template="{name}-{min}-{max} must")
+ * @return string
+ */
+ public function floatTpl()
+ {
+ return 'floatTpl';
+ }
+
/**
* @RequestMapping("enum/{name}")
@@ -126,4 +166,14 @@ public function estring(Request $request, $name)
return [$getName, $postName, $name];
}
+ /**
+ * @RequestMapping("enumTpl")
+ * @Enum(from=ValidatorFrom::GET, name="name", values={1,"a",3}, template="{name}-{value} must")
+ * @return string
+ */
+ public function enumTpl()
+ {
+ return 'enumTpl';
+ }
+
}
\ No newline at end of file
diff --git a/app/Tasks/SyncTask.php b/app/Tasks/SyncTask.php
index 8e187c7a..ecaa8059 100644
--- a/app/Tasks/SyncTask.php
+++ b/app/Tasks/SyncTask.php
@@ -158,7 +158,10 @@ public function rpc2()
public function batchTask(){
sleep(mt_rand(1, 2));
- return 'batchTask';
+
+ /* @var User $user*/
+ $user = User::findById(80368)->getResult();
+ return $user->toJson();
}
/**
diff --git a/test/Cases/ValidatorControllerTest.php b/test/Cases/ValidatorControllerTest.php
index e856fbd9..6979376b 100644
--- a/test/Cases/ValidatorControllerTest.php
+++ b/test/Cases/ValidatorControllerTest.php
@@ -2,7 +2,7 @@
/**
* This file is part of Swoft.
*
- * @link https://swoft.org
+ * @link https://swoft.org
* @document https://doc.swoft.org
* @contact group@swoft.org
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
@@ -49,6 +49,9 @@ public function testString()
$response = $this->request('POST', '/validator/string/swoftPath?name=swoftGet', ['name' => 'swoftPost'], parent::ACCEPT_JSON);
$response->assertExactJson(['swoftGet', 'swoftPost', 'swoftPath']);
+
+ $response = $this->request('GET', '/validator/stringTpl', [], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'name-3-10 must']);
}
/**
@@ -85,6 +88,9 @@ public function testNumber()
$response = $this->request('POST', '/validator/number/9?id=9', ['id' => '9'], parent::ACCEPT_JSON);
$response->assertExactJson(['9', '9', 9]);
+
+ $response = $this->request('GET', '/validator/numberTpl', [], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'id-5-10 must']);
}
/**
@@ -128,6 +134,9 @@ public function testFloat()
$response = $this->request('POST', '/validator/float/5.2?id=5.2', ['id' => '5.2'], parent::ACCEPT_JSON);
$response->assertExactJson(['5.2', '5.2', 5.2]);
+
+ $response = $this->request('GET', '/validator/floatTpl', [], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'id-5.1-5.9 must']);
}
/**
@@ -164,6 +173,9 @@ public function testInteger()
$response = $this->request('POST', '/validator/integer/9?id=9', ['id' => '9'], parent::ACCEPT_JSON);
$response->assertExactJson(['9', '9', 9]);
+
+ $response = $this->request('GET', '/validator/integerTpl', [], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'id-5-10 must']);
}
/**
@@ -182,5 +194,8 @@ public function testEnum()
$response = $this->request('POST', '/validator/enum/1?name=a', ['name' => '3'], parent::ACCEPT_JSON);
$response->assertExactJson(['a', '3', '1']);
+
+ $response = $this->request('GET', '/validator/enumTpl', [], parent::ACCEPT_JSON);
+ $response->assertExactJson(['message' => 'name-null must']);
}
}
\ No newline at end of file
From 7ee907d47401e7ed79a8e5c947eb5da186644ace Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Thu, 3 May 2018 10:17:13 +0800
Subject: [PATCH 228/643] add JsonSerializable
---
app/Controllers/OrmController.php | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/app/Controllers/OrmController.php b/app/Controllers/OrmController.php
index 281cbc92..1a4978e3 100644
--- a/app/Controllers/OrmController.php
+++ b/app/Controllers/OrmController.php
@@ -35,6 +35,34 @@ public function save()
return [$userId];
}
+ public function retEntity()
+ {
+ $user = new User();
+ $user->setName('name');
+ $user->setSex(1);
+ $user->setDesc('this my desc');
+ $user->setAge(mt_rand(1, 100));
+
+ $userId = $user->save()->getResult();
+ $user = User::findById($userId)->getResult();
+
+ return $user;
+ }
+
+ public function retEntitys()
+ {
+ $user = new User();
+ $user->setName('name');
+ $user->setSex(1);
+ $user->setDesc('this my desc');
+ $user->setAge(mt_rand(1, 100));
+
+ $userId = $user->save()->getResult();
+ $users = User::findByIds([$userId])->getResult();
+
+ return $users;
+ }
+
public function findById()
{
$result = User::findById(41710)->getResult();
From 572dc8d39b9b25afebe13077d6ecad82a2888372 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Thu, 3 May 2018 10:20:59 +0800
Subject: [PATCH 229/643] Update .env.example
---
.env.example | 1 +
1 file changed, 1 insertion(+)
diff --git a/.env.example b/.env.example
index dcd08a49..6981ef25 100644
--- a/.env.example
+++ b/.env.example
@@ -1,6 +1,7 @@
# Application
TIME_ZONE=Asia/Shanghai
LOG_ENABLE=false
+APP_DEBUG=false
# Server
PFILE=/tmp/swoft.pid
From 460ca6dc86e896afdea5a2ba06a9c3f73f3d39f6 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Thu, 3 May 2018 10:23:36 +0800
Subject: [PATCH 230/643] Update app.php
---
config/properties/app.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/config/properties/app.php b/config/properties/app.php
index 6e3cb07a..2c6347a9 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -8,6 +8,8 @@
*/
return [
+ 'env' => env('APP_ENV', 'test'),
+ 'debug' => env('APP_DEBUG', false),
'version' => '1.0',
'autoInitBean' => true,
'bootScan' => [
@@ -31,7 +33,6 @@
'I18n' => [
'sourceLanguage' => '@root/resources/messages/',
],
- 'env' => 'Base',
'db' => require __DIR__ . DS . 'db.php',
'cache' => require __DIR__ . DS . 'cache.php',
'service' => require __DIR__ . DS . 'service.php',
From 8f04aaf2c082e1f5c369bb2e7460d5b176c49f39 Mon Sep 17 00:00:00 2001
From: twosee
Date: Fri, 4 May 2018 13:07:51 +0800
Subject: [PATCH 231/643] Correct the words, clear useless code.
---
app/Controllers/DemoController.php | 1 -
app/Controllers/IndexController.php | 9 ++++-----
app/Exception/SwoftExceptionHandler.php | 2 +-
test/Cases/IndexControllerTest.php | 2 +-
4 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/app/Controllers/DemoController.php b/app/Controllers/DemoController.php
index 6aef0fc6..5c50e468 100644
--- a/app/Controllers/DemoController.php
+++ b/app/Controllers/DemoController.php
@@ -18,7 +18,6 @@
use Swoft\Http\Server\Bean\Annotation\RequestMapping;
use Swoft\Http\Server\Bean\Annotation\RequestMethod;
use Swoft\View\Bean\Annotation\View;
-use Swoft\Task\Task;
use Swoft\Core\Application;
use Swoft\Http\Message\Server\Request;
diff --git a/app/Controllers/IndexController.php b/app/Controllers/IndexController.php
index 22702891..91f03d52 100644
--- a/app/Controllers/IndexController.php
+++ b/app/Controllers/IndexController.php
@@ -11,7 +11,6 @@
namespace App\Controllers;
use Swoft\App;
-use Swoft\Core\Coroutine;
use Swoft\Http\Server\Bean\Annotation\Controller;
use Swoft\Http\Server\Bean\Annotation\RequestMapping;
use Swoft\Log\Log;
@@ -37,7 +36,7 @@ public function index(): array
$name = 'Swoft';
$notes = [
'New Generation of PHP Framework',
- 'Hign Performance, Coroutine and Full Stack'
+ 'High Performance, Coroutine and Full Stack'
];
$links = [
[
@@ -73,7 +72,7 @@ public function templateView(): Response
$name = 'Swoft View';
$notes = [
'New Generation of PHP Framework',
- 'Hign Performance, Coroutine and Full Stack'
+ 'High Performance, Coroutine and Full Stack'
];
$links = [
[
@@ -118,7 +117,7 @@ public function toArray(): array
{
return [
'name' => 'Swoft',
- 'notes' => ['New Generation of PHP Framework', 'Hign Performance, Coroutine and Full Stack'],
+ 'notes' => ['New Generation of PHP Framework', 'High Performance, Coroutine and Full Stack'],
'links' => [
[
'name' => 'Home',
@@ -155,7 +154,7 @@ public function absolutePath(): Response
{
$data = [
'name' => 'Swoft',
- 'notes' => ['New Generation of PHP Framework', 'Hign Performance, Coroutine and Full Stack'],
+ 'notes' => ['New Generation of PHP Framework', 'High Performance, Coroutine and Full Stack'],
'links' => [
[
'name' => 'Home',
diff --git a/app/Exception/SwoftExceptionHandler.php b/app/Exception/SwoftExceptionHandler.php
index 7e9e583d..242049f2 100644
--- a/app/Exception/SwoftExceptionHandler.php
+++ b/app/Exception/SwoftExceptionHandler.php
@@ -114,7 +114,7 @@ public function handlerViewException(Request $request, Response $response, \Thro
$name = $throwable->getMessage(). $request->getUri()->getPath();
$notes = [
'New Generation of PHP Framework',
- 'Hign Performance, Coroutine and Full Stack',
+ 'High Performance, Coroutine and Full Stack',
];
$links = [
[
diff --git a/test/Cases/IndexControllerTest.php b/test/Cases/IndexControllerTest.php
index 0fcdcaba..4aca2fd1 100644
--- a/test/Cases/IndexControllerTest.php
+++ b/test/Cases/IndexControllerTest.php
@@ -32,7 +32,7 @@ public function testIndex()
'name' => 'Swoft',
'notes' => [
'New Generation of PHP Framework',
- 'Hign Performance, Coroutine and Full Stack'
+ 'High Performance, Coroutine and Full Stack'
],
'links' => [
[
From 15f45db8bad698f917bbb519c25e8664c90b23ca Mon Sep 17 00:00:00 2001
From: lilin <794774870@qq.com>
Date: Mon, 14 May 2018 23:28:27 +0800
Subject: [PATCH 232/643] modify beanscan
---
config/properties/app.php | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/config/properties/app.php b/config/properties/app.php
index 2c6347a9..31ee66e9 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -16,19 +16,8 @@
'App\Commands',
'App\Boot',
],
- 'beanScan' => [
- 'App\Controllers',
- 'App\Models',
- 'App\Middlewares',
- 'App\Tasks',
- 'App\Services',
- 'App\Breaker',
- 'App\Pool',
- 'App\Exception',
- 'App\Listener',
- 'App\Process',
- 'App\Fallback',
- 'App\WebSocket',
+ 'excludeScan' => [
+
],
'I18n' => [
'sourceLanguage' => '@root/resources/messages/',
@@ -37,5 +26,5 @@
'cache' => require __DIR__ . DS . 'cache.php',
'service' => require __DIR__ . DS . 'service.php',
'breaker' => require __DIR__ . DS . 'breaker.php',
- 'provider' => require __DIR__ . DS . 'provider.php',
+ 'provider' => require __DIR__ . DS . 'provider.php',
];
From 9e9213f0a5f3fcb013dfca5d00f12ccb93791108 Mon Sep 17 00:00:00 2001
From: daydaygo <1252409767@qq.com>
Date: Thu, 24 May 2018 13:45:42 +0800
Subject: [PATCH 233/643] use swoft/swoole-ide-helper (#250)
* use swoft/swoole-ide-helper
* Update composer.json and dev.composer.json
Use 2.1.3 version not master version
---
composer.json | 2 +-
dev.composer.json | 2 +-
docker-compose.yml | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/composer.json b/composer.json
index 80daea5c..ed422c9c 100644
--- a/composer.json
+++ b/composer.json
@@ -32,7 +32,7 @@
"swoft/service-governance": "^1.0"
},
"require-dev": {
- "eaglewu/swoole-ide-helper": "dev-master",
+ "swoft/swoole-ide-helper": "2.1.3",
"phpunit/phpunit": "^5.7"
},
"autoload": {
diff --git a/dev.composer.json b/dev.composer.json
index 984e79d2..7b3335bc 100644
--- a/dev.composer.json
+++ b/dev.composer.json
@@ -33,7 +33,7 @@
"swoft/component": "dev-master as 1.0"
},
"require-dev": {
- "eaglewu/swoole-ide-helper": "dev-master",
+ "swoft/swoole-ide-helper": "2.1.3",
"phpunit/phpunit": "^5.7"
},
"autoload": {
diff --git a/docker-compose.yml b/docker-compose.yml
index bbbaea52..74731cd4 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,8 +1,8 @@
-version: '2'
+version: '3'
services:
swoft:
container_name: swoft
- image: swoft/swoft:latest
+ image: swoft/swoft
ports:
- "80:80"
volumes:
From 772bc208032e011ed34fcda4d30523c0d6443cc0 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Tue, 29 May 2018 11:45:45 +0800
Subject: [PATCH 234/643] swoft/swoole-ide-helper use master
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index ed422c9c..b388e8b6 100644
--- a/composer.json
+++ b/composer.json
@@ -32,7 +32,7 @@
"swoft/service-governance": "^1.0"
},
"require-dev": {
- "swoft/swoole-ide-helper": "2.1.3",
+ "swoft/swoole-ide-helper": "dev-master",
"phpunit/phpunit": "^5.7"
},
"autoload": {
From 545266003792544c4cc975416c3e059daa562a55 Mon Sep 17 00:00:00 2001
From: daydaygo <1252409767@qq.com>
Date: Thu, 31 May 2018 15:46:43 +0800
Subject: [PATCH 235/643] fix #219 (#261)
---
.gitignore | 1 +
Dockerfile | 1 +
2 files changed, 2 insertions(+)
diff --git a/.gitignore b/.gitignore
index 36b10d75..610d543f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@ temp/
.phpintel/
.env
.DS_Store
+public/devtool/
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 01b3602e..2112dbdd 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,6 +14,7 @@ RUN apt-get update \
libz-dev \
libssl-dev \
libnghttp2-dev \
+ libpcre3-dev \
&& apt-get clean \
&& apt-get autoremove
From 3fcc142208eb3124ff9d3f765ccba9651f827646 Mon Sep 17 00:00:00 2001
From: stelin
Date: Sat, 2 Jun 2018 00:35:38 +0800
Subject: [PATCH 236/643] =?UTF-8?q?=E6=96=B0=E5=A2=9EQQ=E7=BE=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 26aae8c7..68643b12 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ The first high-performance PHP coroutine full-stack componentization framework b
[**Chinese Document**](https://doc.swoft.org)
[**English Document**](https://doc.swoft.org) Not yet, please help us write it.
-QQ Group: 548173319
+QQ Group: 548173319/778656850
## Environmental Requirements
From 4f8f9fcaea6d3f7df3cbc7af8123272d327ae05e Mon Sep 17 00:00:00 2001
From: Panda <1017109588@qq.com>
Date: Sun, 3 Jun 2018 06:09:08 +0800
Subject: [PATCH 237/643] Install bcmath (#263)
Install bcmath fix #262
---
Dockerfile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Dockerfile b/Dockerfile
index 2112dbdd..e60c04f3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,6 +26,9 @@ RUN pecl install redis && docker-php-ext-enable redis && pecl clear-cache
RUN docker-php-ext-install pdo_mysql
+# Install bcmath
+RUN docker-php-ext-install bcmath
+
RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.gz \
&& mkdir -p hiredis \
&& tar -xf hiredis.tar.gz -C hiredis --strip-components=1 \
From 0d150464f7d22457760e130f38c75831c86e383d Mon Sep 17 00:00:00 2001
From: Panda <1017109588@qq.com>
Date: Sun, 3 Jun 2018 09:30:32 +0800
Subject: [PATCH 238/643] composer.json add ext-swoole (#264)
composer.json add ext-swoole
---
composer.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/composer.json b/composer.json
index b388e8b6..867e0787 100644
--- a/composer.json
+++ b/composer.json
@@ -10,6 +10,7 @@
"license": "Apache-2.0",
"require": {
"php": ">=7.0",
+ "ext-swoole": ">=2.1",
"swoft/framework": "^1.0",
"swoft/rpc": "^1.0",
"swoft/rpc-server": "^1.0",
From 58b863e05c271887320964f7f2e9251327e8a3b4 Mon Sep 17 00:00:00 2001
From: Daniel Ruf
Date: Wed, 6 Jun 2018 22:27:04 +0200
Subject: [PATCH 239/643] chore: cache dependencies (#270)
* chore: cache dependencies
* chore: trigger new build
---
.travis.yml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index e54460c7..ad955eb1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,3 +12,7 @@ before_script:
- composer update --dev
script: composer test
+
+cache:
+ directories:
+ - "$HOME/.composer/cache/files"
\ No newline at end of file
From f4e69c426da0e1962a62e24992cf9114afd982ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Sat, 9 Jun 2018 22:32:18 +0800
Subject: [PATCH 240/643] Upgrade swoole to v2.2.0
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index e60c04f3..59183381 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -41,7 +41,7 @@ RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.
) \
&& rm -r hiredis
-RUN wget https://github.com/swoole/swoole-src/archive/v2.1.3.tar.gz -O swoole.tar.gz \
+RUN wget https://github.com/swoole/swoole-src/archive/v2.2.0.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
&& rm swoole.tar.gz \
From 5c97791dec074351f1c1be829d0dbc6f70464799 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Sat, 9 Jun 2018 22:34:08 +0800
Subject: [PATCH 241/643] Optimize grammar
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 68643b12..2194d9a4 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
## Introduction
-The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
+The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
- Base on Swoole extension
- Built-in HTTP, TCP, WebSocket Server
From 9dfc6ab7fc4f07b937e7a81698a5553064cac75c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Sat, 9 Jun 2018 22:36:17 +0800
Subject: [PATCH 242/643] add php-cs-fixer (#273)
---
composer.json | 122 +++++++++++++++++++++++-----------------------
dev.composer.json | 24 ++++-----
2 files changed, 75 insertions(+), 71 deletions(-)
diff --git a/composer.json b/composer.json
index 867e0787..d3836497 100644
--- a/composer.json
+++ b/composer.json
@@ -1,64 +1,66 @@
{
- "name": "swoft/swoft",
- "type": "project",
- "keywords": [
- "php",
- "swoole",
- "swoft"
- ],
- "description": "Modern High performance AOP and Coroutine PHP Framework, base on Swoole 2",
- "license": "Apache-2.0",
- "require": {
- "php": ">=7.0",
- "ext-swoole": ">=2.1",
- "swoft/framework": "^1.0",
- "swoft/rpc": "^1.0",
- "swoft/rpc-server": "^1.0",
- "swoft/rpc-client": "^1.0",
- "swoft/http-server": "^1.0",
- "swoft/http-client": "^1.0",
- "swoft/websocket-server": "^1.0",
- "swoft/task": "^1.0",
- "swoft/http-message": "^1.0",
- "swoft/view": "^1.0",
- "swoft/db": "^1.0",
- "swoft/cache": "^1.0",
- "swoft/redis": "^1.0",
- "swoft/console": "^1.0",
- "swoft/devtool": "^1.0",
- "swoft/session": "^1.0",
- "swoft/i18n": "^1.0",
- "swoft/process": "^1.0",
- "swoft/memory": "^1.0",
- "swoft/service-governance": "^1.0"
- },
- "require-dev": {
- "swoft/swoole-ide-helper": "dev-master",
- "phpunit/phpunit": "^5.7"
- },
- "autoload": {
- "psr-4": {
- "App\\": "app/"
- },
- "files": [
- "app/Swoft.php"
- ]
- },
- "autoload-dev": {
- "psr-4": {
- "Swoft\\Test\\": "test/"
- }
- },
- "scripts": {
- "post-root-package-install": [
- "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
+ "name": "swoft/swoft",
+ "type": "project",
+ "keywords": [
+ "php",
+ "swoole",
+ "swoft"
],
- "test": "./vendor/bin/phpunit -c phpunit.xml"
- },
- "repositories": {
- "packagist": {
- "type": "composer",
- "url": "https://packagist.phpcomposer.com/"
+ "description": "Modern High performance AOP and Coroutine PHP Framework, base on Swoole 2",
+ "license": "Apache-2.0",
+ "require": {
+ "php": ">=7.0",
+ "ext-swoole": ">=2.1",
+ "swoft/framework": "^1.0",
+ "swoft/rpc": "^1.0",
+ "swoft/rpc-server": "^1.0",
+ "swoft/rpc-client": "^1.0",
+ "swoft/http-server": "^1.0",
+ "swoft/http-client": "^1.0",
+ "swoft/websocket-server": "^1.0",
+ "swoft/task": "^1.0",
+ "swoft/http-message": "^1.0",
+ "swoft/view": "^1.0",
+ "swoft/db": "^1.0",
+ "swoft/cache": "^1.0",
+ "swoft/redis": "^1.0",
+ "swoft/console": "^1.0",
+ "swoft/devtool": "^1.0",
+ "swoft/session": "^1.0",
+ "swoft/i18n": "^1.0",
+ "swoft/process": "^1.0",
+ "swoft/memory": "^1.0",
+ "swoft/service-governance": "^1.0"
+ },
+ "require-dev": {
+ "swoft/swoole-ide-helper": "dev-master",
+ "phpunit/phpunit": "^5.7",
+ "friendsofphp/php-cs-fixer": "^2.10"
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "app/"
+ },
+ "files": [
+ "app/Swoft.php"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Swoft\\Test\\": "test/"
+ }
+ },
+ "scripts": {
+ "post-root-package-install": [
+ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
+ ],
+ "test": "./vendor/bin/phpunit -c phpunit.xml",
+ "cs-fix": "./vendor/bin/php-cs-fixer fix $1"
+ },
+ "repositories": {
+ "packagist": {
+ "type": "composer",
+ "url": "https://packagist.phpcomposer.com/"
+ }
}
- }
}
diff --git a/dev.composer.json b/dev.composer.json
index 7b3335bc..30519b36 100644
--- a/dev.composer.json
+++ b/dev.composer.json
@@ -34,7 +34,8 @@
},
"require-dev": {
"swoft/swoole-ide-helper": "2.1.3",
- "phpunit/phpunit": "^5.7"
+ "phpunit/phpunit": "^5.7",
+ "friendsofphp/php-cs-fixer": "^2.10"
},
"autoload": {
"psr-4": {
@@ -53,16 +54,17 @@
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
- "test": "./vendor/bin/phpunit -c phpunit.xml"
+ "test": "./vendor/bin/phpunit -c phpunit.xml",
+ "cs-fix": "./vendor/bin/php-cs-fixer fix $1"
},
- "repositories": [
- {
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-component"
- },
- {
- "type": "composer",
- "url": "https://packagist.phpcomposer.com/"
- }
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/swoft-cloud/swoft-component"
+ },
+ {
+ "type": "composer",
+ "url": "https://packagist.phpcomposer.com/"
+ }
]
}
From 813915db905d3d2cc1369d9f7de9a7c3df1d3299 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Sat, 9 Jun 2018 22:40:01 +0800
Subject: [PATCH 243/643] Update Dockerfile
---
Dockerfile | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 59183381..9218dc39 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,9 +2,11 @@ FROM php:7.1
MAINTAINER huangzhhui
+# Timezone
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo 'Asia/Shanghai' > /etc/timezone
+# Libs
RUN apt-get update \
&& apt-get install -y \
curl \
@@ -22,13 +24,16 @@ RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& composer self-update --clean-backups
+# Redis extension
RUN pecl install redis && docker-php-ext-enable redis && pecl clear-cache
+# PDO extension
RUN docker-php-ext-install pdo_mysql
-# Install bcmath
+# Bcmath extension
RUN docker-php-ext-install bcmath
+# Hiredis
RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.gz \
&& mkdir -p hiredis \
&& tar -xf hiredis.tar.gz -C hiredis --strip-components=1 \
@@ -40,7 +45,8 @@ RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.
&& ldconfig \
) \
&& rm -r hiredis
-
+
+# Swoole extension
RUN wget https://github.com/swoole/swoole-src/archive/v2.2.0.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
@@ -58,6 +64,7 @@ RUN wget https://github.com/swoole/swoole-src/archive/v2.2.0.tar.gz -O swoole.ta
ADD . /var/www/swoft
WORKDIR /var/www/swoft
+
RUN composer install --no-dev \
&& composer dump-autoload -o \
&& composer clearcache
From cd6207709560ee16bebc89e8a4d19522d5ad0daa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Sat, 9 Jun 2018 23:07:57 +0800
Subject: [PATCH 244/643] add multiFilesInOneKey action to Psr7Controller
(#275)
---
app/Controllers/Psr7Controller.php | 58 ++++++++++++++++--------------
1 file changed, 32 insertions(+), 26 deletions(-)
diff --git a/app/Controllers/Psr7Controller.php b/app/Controllers/Psr7Controller.php
index aba85a4a..bb420fcd 100644
--- a/app/Controllers/Psr7Controller.php
+++ b/app/Controllers/Psr7Controller.php
@@ -11,17 +11,12 @@
namespace App\Controllers;
use Psr\Http\Message\UploadedFileInterface;
+use Swoft\Http\Message\Server\Request;
use Swoft\Http\Server\Bean\Annotation\Controller;
use Swoft\Http\Server\Bean\Annotation\RequestMapping;
-use Swoft\Http\Message\Server\Request;
/**
* @Controller(prefix="/psr7")
- * @uses Psr7Controller
- * @version 2017-11-05
- * @author huangzhhui
- * @copyright Copyright 2010-2017 Swoft software
- * @license PHP Version 7.x {@link http://www.php.net/license/3_0.txt}
*/
class Psr7Controller
{
@@ -29,10 +24,9 @@ class Psr7Controller
/**
* @RequestMapping()
* @param \Swoft\Http\Message\Server\Request $request
- *
* @return array
*/
- public function get(Request $request)
+ public function get(Request $request): array
{
$param1 = $request->query('param1');
$param2 = $request->query('param2', 'defaultValue');
@@ -41,12 +35,10 @@ public function get(Request $request)
/**
* @RequestMapping()
- *
* @param \Swoft\Http\Message\Server\Request $request
- *
* @return array
*/
- public function post(Request $request)
+ public function post(Request $request): array
{
$param1 = $request->post('param1');
$param2 = $request->post('param2');
@@ -55,12 +47,10 @@ public function post(Request $request)
/**
* @RequestMapping()
- *
* @param \Swoft\Http\Message\Server\Request $request
- *
* @return array
*/
- public function input(Request $request)
+ public function input(Request $request): array
{
$param1 = $request->input('param1');
$inputs = $request->input();
@@ -74,10 +64,9 @@ public function input(Request $request)
/**
* @RequestMapping()
* @param \Swoft\Http\Message\Server\Request $request
- *
* @return array
*/
- public function raw(Request $request)
+ public function raw(Request $request): array
{
$param1 = $request->raw();
return compact('param1');
@@ -86,10 +75,9 @@ public function raw(Request $request)
/**
* @RequestMapping()
* @param \Swoft\Http\Message\Server\Request $request
- *
* @return array
*/
- public function cookies(Request $request)
+ public function cookies(Request $request): array
{
$cookie1 = $request->cookie();
return compact('cookie1');
@@ -97,12 +85,10 @@ public function cookies(Request $request)
/**
* @RequestMapping()
- *
* @param \Swoft\Http\Message\Server\Request $request
- *
* @return array
*/
- public function header(Request $request)
+ public function header(Request $request): array
{
$header1 = $request->header();
$host = $request->header('host');
@@ -112,10 +98,9 @@ public function header(Request $request)
/**
* @RequestMapping()
* @param \Swoft\Http\Message\Server\Request $request
- *
* @return array
*/
- public function json(Request $request)
+ public function json(Request $request): array
{
$json = $request->json();
$jsonParam = $request->json('jsonParam');
@@ -125,16 +110,15 @@ public function json(Request $request)
/**
* @RequestMapping()
* @param \Swoft\Http\Message\Server\Request $request
- *
* @return array
*/
- public function files(Request $request)
+ public function files(Request $request): array
{
$files = $request->file();
foreach ($files as $file) {
if ($file instanceof UploadedFileInterface) {
try {
- $file->moveTo('@runtime/uploadfiles/1.png');
+ $file->moveTo('@runtime/uploadfiles/' . $file->getClientFilename());
$move = true;
} catch (\Throwable $e) {
$move = false;
@@ -145,4 +129,26 @@ public function files(Request $request)
return compact('move');
}
+ /**
+ * @RequestMapping()
+ * @param \Swoft\Http\Message\Server\Request $request
+ * @return array|null|\Swoft\Http\Message\Upload\UploadedFile
+ */
+ public function multiFilesInOneKey(Request $request)
+ {
+ $files = $request->file('files');
+ foreach ($files as $file) {
+ if ($file instanceof UploadedFileInterface) {
+ try {
+ $file->moveTo('@runtime/uploadfiles/' . $file->getClientFilename());
+ $move[$file->getClientFilename()] = true;
+ } catch (\Throwable $e) {
+ $move[$file->getClientFilename()] = false;
+ }
+ }
+ }
+
+ return compact('move');
+ }
+
}
\ No newline at end of file
From 5c74a041530b9dd04298ffbd8072b8a820fd2865 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Thu, 14 Jun 2018 18:07:38 +0800
Subject: [PATCH 245/643] Update Dockerfile
Upgrade swoole to v4.0.0
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 9218dc39..1ae4c2af 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -47,7 +47,7 @@ RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.
&& rm -r hiredis
# Swoole extension
-RUN wget https://github.com/swoole/swoole-src/archive/v2.2.0.tar.gz -O swoole.tar.gz \
+RUN wget https://github.com/swoole/swoole-src/archive/v4.0.0.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
&& rm swoole.tar.gz \
From 9369bc5591bf9d9cdf96610ebe6228a72c4d82be Mon Sep 17 00:00:00 2001
From: Inhere
Date: Tue, 19 Jun 2018 09:17:51 +0800
Subject: [PATCH 246/643] add TCP_PACKAGE_EOF setting for tcp (#286)
---
config/server.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/config/server.php b/config/server.php
index c0dd2b19..12507aa5 100644
--- a/config/server.php
+++ b/config/server.php
@@ -18,15 +18,16 @@
'tcp' => [
'host' => env('TCP_HOST', '0.0.0.0'),
'port' => env('TCP_PORT', 8099),
- 'mode' => env('TCP_MODE', SWOOLE_PROCESS),
+ 'mode' => env('TCP_MODE', SWOOLE_PROCESS),
'type' => env('TCP_TYPE', SWOOLE_SOCK_TCP),
'package_max_length' => env('TCP_PACKAGE_MAX_LENGTH', 2048),
'open_eof_check' => env('TCP_OPEN_EOF_CHECK', false),
+ 'package_eof' => "\r\n",
],
'http' => [
'host' => env('HTTP_HOST', '0.0.0.0'),
'port' => env('HTTP_PORT', 80),
- 'mode' => env('HTTP_MODE', SWOOLE_PROCESS),
+ 'mode' => env('HTTP_MODE', SWOOLE_PROCESS),
'type' => env('HTTP_TYPE', SWOOLE_SOCK_TCP),
],
'ws' => [
From 850c818ef97388acbcb44665c1a1bd8474ee3eaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Fri, 29 Jun 2018 14:14:26 +0800
Subject: [PATCH 247/643] Update Dockerfile
Upgrade swoole to 4.0.1 version and remove configure argument --enable-coroutine
---
Dockerfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 1ae4c2af..d2900ae4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -47,14 +47,14 @@ RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.
&& rm -r hiredis
# Swoole extension
-RUN wget https://github.com/swoole/swoole-src/archive/v4.0.0.tar.gz -O swoole.tar.gz \
+RUN wget https://github.com/swoole/swoole-src/archive/v4.0.1.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
&& rm swoole.tar.gz \
&& ( \
cd swoole \
&& phpize \
- && ./configure --enable-async-redis --enable-mysqlnd --enable-coroutine --enable-openssl --enable-http2 \
+ && ./configure --enable-async-redis --enable-mysqlnd --enable-openssl --enable-http2 \
&& make -j$(nproc) \
&& make install \
) \
From 909d37cc4d527bf63b63530abf899356a12d063f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Fri, 29 Jun 2018 16:17:26 +0800
Subject: [PATCH 248/643] Update composer.json
Add PsySH
---
composer.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index d3836497..06444292 100644
--- a/composer.json
+++ b/composer.json
@@ -35,7 +35,8 @@
"require-dev": {
"swoft/swoole-ide-helper": "dev-master",
"phpunit/phpunit": "^5.7",
- "friendsofphp/php-cs-fixer": "^2.10"
+ "friendsofphp/php-cs-fixer": "^2.10",
+ "psy/psysh": "@stable"
},
"autoload": {
"psr-4": {
From 4fd66cc632683da15e8890678bd0b7f696a33cfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Fri, 29 Jun 2018 16:17:47 +0800
Subject: [PATCH 249/643] Update dev.composer.json
add PsySH
---
dev.composer.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dev.composer.json b/dev.composer.json
index 30519b36..49cf298f 100644
--- a/dev.composer.json
+++ b/dev.composer.json
@@ -35,7 +35,8 @@
"require-dev": {
"swoft/swoole-ide-helper": "2.1.3",
"phpunit/phpunit": "^5.7",
- "friendsofphp/php-cs-fixer": "^2.10"
+ "friendsofphp/php-cs-fixer": "^2.10",
+ "psy/psysh": "@stable"
},
"autoload": {
"psr-4": {
From f6c937f296342d1f76179734220bd8ca8d896c92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Fri, 29 Jun 2018 16:18:30 +0800
Subject: [PATCH 250/643] Update dev.composer.json
use ssh instead of https
---
dev.composer.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dev.composer.json b/dev.composer.json
index 49cf298f..51ef7ec4 100644
--- a/dev.composer.json
+++ b/dev.composer.json
@@ -60,8 +60,8 @@
},
"repositories": [
{
- "type": "vcs",
- "url": "https://github.com/swoft-cloud/swoft-component"
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-component.git"
},
{
"type": "composer",
From 90a6dd537614ae59f7f012e1548a3a0b410e108d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Wed, 4 Jul 2018 12:36:32 +0800
Subject: [PATCH 251/643] Add phpstorm meta file and fix validator unit test
(#300)
* fix ValidatorController unit test
* add .phpstorm.meta.php for IDE
* add open_eof_split
---
.phpstorm.meta.php | 20 +++++++
config/server.php | 1 +
test/Cases/ValidatorControllerTest.php | 82 +++++++++++++-------------
3 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 .phpstorm.meta.php
diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php
new file mode 100644
index 00000000..fff23cc3
--- /dev/null
+++ b/.phpstorm.meta.php
@@ -0,0 +1,20 @@
+ \Swoft\Defer\Defer::class,
+ ];
+ override(\bean(0), map($map));
+ override(\Swoft\App::getBean(0), map($map));
+ override(\Swoft\Core\ApplicationContext::getBean(0), map($map));
+ override(\Swoft\Bean\BeanFactory::getBean(0), map($map));
+
+}
\ No newline at end of file
diff --git a/config/server.php b/config/server.php
index 12507aa5..0f25c2bc 100644
--- a/config/server.php
+++ b/config/server.php
@@ -22,6 +22,7 @@
'type' => env('TCP_TYPE', SWOOLE_SOCK_TCP),
'package_max_length' => env('TCP_PACKAGE_MAX_LENGTH', 2048),
'open_eof_check' => env('TCP_OPEN_EOF_CHECK', false),
+ 'open_eof_split' => env('TCP_OPEN_EOF_SPLIT', true),
'package_eof' => "\r\n",
],
'http' => [
diff --git a/test/Cases/ValidatorControllerTest.php b/test/Cases/ValidatorControllerTest.php
index 6979376b..53f79c97 100644
--- a/test/Cases/ValidatorControllerTest.php
+++ b/test/Cases/ValidatorControllerTest.php
@@ -30,28 +30,28 @@ public function testString()
$response->assertExactJson(['boy', 'girl', 'swoft']);
$response = $this->request('POST', '/validator/string/c', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter name length is too short (minimum is 3)']);
+ $response->assertJsonFragment(['message' => 'Parameter name length is too short (minimum is 3)']);
$response = $this->request('POST', '/validator/string/swoft', ['name' => 'a'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter name length is too short (minimum is 3)']);
+ $response->assertJsonFragment(['message' => 'Parameter name length is too short (minimum is 3)']);
$response = $this->request('POST', '/validator/string/swoft?name=b', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter name length is too short (minimum is 3)']);
+ $response->assertJsonFragment(['message' => 'Parameter name length is too short (minimum is 3)']);
$response = $this->request('POST', '/validator/string/swoft66666666', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter name length is too long (maximum is 10)']);
+ $response->assertJsonFragment(['message' => 'Parameter name length is too long (maximum is 10)']);
$response = $this->request('POST', '/validator/string/swoft', ['name' => 'swoft66666666'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter name length is too long (maximum is 10)']);
+ $response->assertJsonFragment(['message' => 'Parameter name length is too long (maximum is 10)']);
$response = $this->request('POST', '/validator/string/swoft?name=swoft66666666', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter name length is too long (maximum is 10)']);
+ $response->assertJsonFragment(['message' => 'Parameter name length is too long (maximum is 10)']);
$response = $this->request('POST', '/validator/string/swoftPath?name=swoftGet', ['name' => 'swoftPost'], parent::ACCEPT_JSON);
$response->assertExactJson(['swoftGet', 'swoftPost', 'swoftPath']);
$response = $this->request('GET', '/validator/stringTpl', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'name-3-10 must']);
+ $response->assertJsonFragment(['message' => 'name-3-10 must']);
}
/**
@@ -63,34 +63,34 @@ public function testNumber()
$response->assertExactJson([7, 8, 10]);
$response = $this->request('POST', '/validator/number/3', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/number/6', ['id' => '-2'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is not a number']);
+ $response->assertJsonFragment(['message' => 'Parameter id is not a number']);
$response = $this->request('POST', '/validator/number/6', ['id' => '2'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/number/6?id=-2', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is not a number']);
+ $response->assertJsonFragment(['message' => 'Parameter id is not a number']);
$response = $this->request('POST', '/validator/number/6?id=2', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/number/12', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/number/9', ['id' => '12'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/number/9?id=12', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/number/9?id=9', ['id' => '9'], parent::ACCEPT_JSON);
$response->assertExactJson(['9', '9', 9]);
$response = $this->request('GET', '/validator/numberTpl', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'id-5-10 must']);
+ $response->assertJsonFragment(['message' => 'id-5-10 must']);
}
/**
@@ -99,44 +99,44 @@ public function testNumber()
public function testFloat()
{
$response = $this->request('GET', '/validator/float/a', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is not float type']);
+ $response->assertJsonFragment(['message' => 'Parameter id is not float type']);
$response = $this->request('GET', '/validator/float/5', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is not float type']);
+ $response->assertJsonFragment(['message' => 'Parameter id is not float type']);
$response = $this->request('POST', '/validator/float/5.0', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/float/6.0', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too big (maximum is 5)']);
$response = $this->request('POST', '/validator/float/5.2', ['id' => 5], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is not float type']);
+ $response->assertJsonFragment(['message' => 'Parameter id is not float type']);
$response = $this->request('POST', '/validator/float/5.2', ['id' => '5.0'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/float/5.2', ['id' => '6.0'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too big (maximum is 5)']);
$response = $this->request('POST', '/validator/float/5.2', ['id' => '5.2'], parent::ACCEPT_JSON);
$response->assertExactJson([5.6, '5.2', 5.2]);
$response = $this->request('POST', '/validator/float/5.2?id=5', [5.2], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is not float type']);
+ $response->assertJsonFragment(['message' => 'Parameter id is not float type']);
$response = $this->request('POST', '/validator/float/5.2?id=5.0', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/float/5.2?id=6.0', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too big (maximum is 5)']);
$response = $this->request('POST', '/validator/float/5.2?id=5.2', ['id' => '5.2'], parent::ACCEPT_JSON);
$response->assertExactJson(['5.2', '5.2', 5.2]);
$response = $this->request('GET', '/validator/floatTpl', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'id-5.1-5.9 must']);
+ $response->assertJsonFragment(['message' => 'id-5.1-5.9 must']);
}
/**
@@ -148,54 +148,54 @@ public function testInteger()
$response->assertExactJson([7, 8, 10]);
$response = $this->request('POST', '/validator/integer/3', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/integer/6', ['id' => 'a'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is not integer type']);
+ $response->assertJsonFragment(['message' => 'Parameter id is not integer type']);
$response = $this->request('POST', '/validator/integer/6', ['id' => '2'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/integer/6?id=a', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is not integer type']);
+ $response->assertJsonFragment(['message' => 'Parameter id is not integer type']);
$response = $this->request('POST', '/validator/integer/6?id=2', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too small (minimum is 5)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too small (minimum is 5)']);
$response = $this->request('POST', '/validator/integer/12', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/integer/9', ['id' => '12'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/integer/9?id=12', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter id is too big (maximum is 10)']);
+ $response->assertJsonFragment(['message' => 'Parameter id is too big (maximum is 10)']);
$response = $this->request('POST', '/validator/integer/9?id=9', ['id' => '9'], parent::ACCEPT_JSON);
$response->assertExactJson(['9', '9', 9]);
$response = $this->request('GET', '/validator/integerTpl', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'id-5-10 must']);
+ $response->assertJsonFragment(['message' => 'id-5-10 must']);
}
/**
- * @covers \App\Controllers\ValidatorController::enum
+ * @covers \App\Controllers\ValidatorController::estring
*/
public function testEnum()
{
$response = $this->request('POST', '/validator/enum/4', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter name is an invalid enum value']);
+ $response->assertJsonFragment(['message' => 'Parameter name is an invalid enum value']);
$response = $this->request('POST', '/validator/enum/1?name=4', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter name is an invalid enum value']);
+ $response->assertJsonFragment(['message' => 'Parameter name is an invalid enum value']);
$response = $this->request('POST', '/validator/enum/1', ['name' => '4'], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'Parameter name is an invalid enum value']);
+ $response->assertJsonFragment(['message' => 'Parameter name is an invalid enum value']);
$response = $this->request('POST', '/validator/enum/1?name=a', ['name' => '3'], parent::ACCEPT_JSON);
$response->assertExactJson(['a', '3', '1']);
$response = $this->request('GET', '/validator/enumTpl', [], parent::ACCEPT_JSON);
- $response->assertExactJson(['message' => 'name-null must']);
+ $response->assertJsonFragment(['message' => 'name-null must']);
}
}
\ No newline at end of file
From e034f35f04013bb5f561181301b4ab7c94295bd8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Fri, 6 Jul 2018 13:16:35 +0800
Subject: [PATCH 252/643] Update composer.json
Upgrade db to v1.1
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index 06444292..5c17ff85 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,7 @@
"swoft/task": "^1.0",
"swoft/http-message": "^1.0",
"swoft/view": "^1.0",
- "swoft/db": "^1.0",
+ "swoft/db": "^1.1",
"swoft/cache": "^1.0",
"swoft/redis": "^1.0",
"swoft/console": "^1.0",
From d6ffcb474581c002f96f19e83a94fef1d21a51cd Mon Sep 17 00:00:00 2001
From: stelin
Date: Tue, 24 Jul 2018 10:59:55 +0800
Subject: [PATCH 253/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2194d9a4..0bd4dc34 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ The first high-performance PHP coroutine full-stack componentization framework b
[**Chinese Document**](https://doc.swoft.org)
[**English Document**](https://doc.swoft.org) Not yet, please help us write it.
-QQ Group: 548173319/778656850
+QQ Group1: 548173319(full) QQ Group2: 778656850
## Environmental Requirements
From 1bebfdcef3a2ef5e7ce23d04559f4e3c71a3c09e Mon Sep 17 00:00:00 2001
From: stelin
Date: Tue, 24 Jul 2018 11:00:50 +0800
Subject: [PATCH 254/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 0bd4dc34..666d42b5 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ The first high-performance PHP coroutine full-stack componentization framework b
[**Chinese Document**](https://doc.swoft.org)
[**English Document**](https://doc.swoft.org) Not yet, please help us write it.
-QQ Group1: 548173319(full) QQ Group2: 778656850
+QQ Group1: 548173319(full) QQ Group2: 778656850
## Environmental Requirements
From 1914b411112e64610bd3b37ca48d3aa0692fce38 Mon Sep 17 00:00:00 2001
From: stelin
Date: Tue, 24 Jul 2018 11:01:57 +0800
Subject: [PATCH 255/643] Update README.md
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 666d42b5..712da9a0 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,8 @@ The first high-performance PHP coroutine full-stack componentization framework b
[**Chinese Document**](https://doc.swoft.org)
[**English Document**](https://doc.swoft.org) Not yet, please help us write it.
-QQ Group1: 548173319(full) QQ Group2: 778656850
+QQ Group1: 548173319(full)
+QQ Group2: 778656850
## Environmental Requirements
From ae5af7fff9c6a5dcc8f38d97b42aba8f0f04d69d Mon Sep 17 00:00:00 2001
From: stelin
Date: Tue, 24 Jul 2018 11:03:44 +0800
Subject: [PATCH 256/643] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 712da9a0..87cfd78d 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ The first high-performance PHP coroutine full-stack componentization framework b
[**Chinese Document**](https://doc.swoft.org)
[**English Document**](https://doc.swoft.org) Not yet, please help us write it.
-QQ Group1: 548173319(full)
+QQ Group1: 548173319(Full)
QQ Group2: 778656850
## Environmental Requirements
From 61b73354692b693b958a26537bf08b9b91088564 Mon Sep 17 00:00:00 2001
From: stelin
Date: Tue, 24 Jul 2018 13:22:52 +0800
Subject: [PATCH 257/643] Update README_CN.md
---
README_CN.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README_CN.md b/README_CN.md
index 99bf2d1c..01724604 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -48,7 +48,8 @@
[**中文文档**](https://doc.swoft.org)
-QQ 交流群: 548173319
+QQ 交流群1: 548173319(已满)
+QQ 交流群2: 778656850
## 环境要求
From 80c58612b38d5b3b0e35d95a0de823504c97c339 Mon Sep 17 00:00:00 2001
From: whiteCcinn <471113744@qq.com>
Date: Thu, 26 Jul 2018 18:22:55 +0800
Subject: [PATCH 258/643] add docker-compose env contents
---
.env.example.docker-compose | 114 ++++++++++++++++++++++++++++++++++++
Dockerfile | 19 ++++--
demo.sql | 16 +++++
docker-compose.yml | 33 ++++++++++-
4 files changed, 175 insertions(+), 7 deletions(-)
create mode 100644 .env.example.docker-compose
create mode 100644 demo.sql
diff --git a/.env.example.docker-compose b/.env.example.docker-compose
new file mode 100644
index 00000000..018e67df
--- /dev/null
+++ b/.env.example.docker-compose
@@ -0,0 +1,114 @@
+# Application
+TIME_ZONE=Asia/Shanghai
+LOG_ENABLE=false
+APP_DEBUG=false
+
+# Server
+PFILE=/tmp/swoft.pid
+PNAME=php-swoft
+TCPABLE=true
+CRONABLE=false
+AUTO_RELOAD=true
+AUTO_REGISTER=false
+
+# HTTP
+HTTP_HOST=0.0.0.0
+HTTP_PORT=80
+HTTP_MODE=SWOOLE_PROCESS
+HTTP_TYPE=SWOOLE_SOCK_TCP
+
+# WebSocket
+WS_ENABLE_HTTP=true
+
+# TCP
+TCP_HOST=0.0.0.0
+TCP_PORT=8099
+TCP_MODE=SWOOLE_PROCESS
+TCP_TYPE=SWOOLE_SOCK_TCP
+TCP_PACKAGE_MAX_LENGTH=2048
+TCP_OPEN_EOF_CHECK=false
+
+# Crontab
+CRONTAB_TASK_COUNT=1024
+CRONTAB_TASK_QUEUE=2048
+
+# Swoole Settings
+WORKER_NUM=1
+MAX_REQUEST=100000
+DAEMONIZE=0
+DISPATCH_MODE=2
+TASK_IPC_MODE=1
+MESSAGE_QUEUE_KEY=1879052289
+TASK_TMPDIR=/tmp/
+LOG_FILE=@runtime/logs/swoole.log
+TASK_WORKER_NUM=1
+PACKAGE_MAX_LENGTH=2048
+OPEN_HTTP2_PROTOCOL=false
+SSL_CERT_FILE=/path/to/ssl_cert_file
+SSL_KEY_FILE=/path/to/ssl_key_file
+
+# Database Master nodes
+DB_NAME=dbMaster
+DB_URI=mysql:3306/test?user=root&password=123456&charset=utf8,mysql:3306/test?user=root&password=123456&charset=utf8
+DB_MIN_ACTIVE=5
+DB_MAX_ACTIVE=10
+DB_MAX_WAIT=20
+DB_MAX_WAIT_TIME=3
+DB_MAX_IDLE_TIME=60
+DB_TIMEOUT=2
+
+# Database Slave nodes
+DB_SLAVE_NAME=dbSlave
+DB_SLAVE_URI=mysql:3306/test?user=root&password=123456&charset=utf8,mysql:3306/test?user=root&password=123456&charset=utf8
+DB_SLAVE_MIN_ACTIVE=5
+DB_SLAVE_MAX_ACTIVE=10
+DB_SLAVE_MAX_WAIT=20
+DB_SLAVE_MAX_WAIT_TIME=3
+DB_SLAVE_MAX_IDLE_TIME=60
+DB_SLAVE_TIMEOUT=3
+
+# Redis
+REDIS_NAME=redis
+REDIS_DB=2
+REDIS_URI=redis:6379,redis:6379
+REDIS_MIN_ACTIVE=5
+REDIS_MAX_ACTIVE=10
+REDIS_MAX_WAIT=20
+REDIS_MAX_WAIT_TIME=3
+REDIS_MAX_IDLE_TIME=60
+REDIS_TIMEOUT=3
+REDIS_SERIALIZE=1
+
+# other redis node
+REDIS_DEMO_REDIS_DB=6
+REDIS_DEMO_REDIS_PREFIX=demo_redis_
+
+# User service (demo service)
+USER_POOL_NAME=user
+USER_POOL_URI=127.0.0.1:8099,127.0.0.1:8099
+USER_POOL_MIN_ACTIVE=5
+USER_POOL_MAX_ACTIVE=10
+USER_POOL_MAX_WAIT=20
+USER_POOL_TIMEOUT=200
+USER_POOL_MAX_WAIT_TIME=3
+USER_POOL_MAX_IDLE_TIME=60
+USER_POOL_USE_PROVIDER=false
+USER_POOL_BALANCER=random
+USER_POOL_PROVIDER=consul
+
+# User service breaker (demo service)
+USER_BREAKER_FAIL_COUNT = 3
+USER_BREAKER_SUCCESS_COUNT = 6
+USER_BREAKER_DELAY_TIME = 5000
+
+# Consul
+CONSUL_ADDRESS=http://127.0.0.1
+CONSUL_PORT=8500
+CONSUL_REGISTER_NAME=user
+CONSUL_REGISTER_ETO=false
+CONSUL_REGISTER_SERVICE_ADDRESS=127.0.0.1
+CONSUL_REGISTER_SERVICE_PORT=8099
+CONSUL_REGISTER_CHECK_NAME=user
+CONSUL_REGISTER_CHECK_TCP=127.0.0.1:8099
+CONSUL_REGISTER_CHECK_INTERVAL=10
+CONSUL_REGISTER_CHECK_TIMEOUT=1
diff --git a/Dockerfile b/Dockerfile
index d2900ae4..4d4d8e32 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,6 +2,11 @@ FROM php:7.1
MAINTAINER huangzhhui
+# Version
+ENV PHPREDIS_VERSION 4.0.0
+ENV HIREDIS_VERSION 0.13.3
+ENV SWOOLE_VERSION 4.0.1
+
# Timezone
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo 'Asia/Shanghai' > /etc/timezone
@@ -20,21 +25,25 @@ RUN apt-get update \
&& apt-get clean \
&& apt-get autoremove
+# Composer
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& composer self-update --clean-backups
-# Redis extension
-RUN pecl install redis && docker-php-ext-enable redis && pecl clear-cache
-
# PDO extension
RUN docker-php-ext-install pdo_mysql
# Bcmath extension
RUN docker-php-ext-install bcmath
+# Redis extension
+RUN wget http://pecl.php.net/get/redis-${PHPREDIS_VERSION}.tgz -O /tmp/redis.tar.tgz \
+ && pecl install /tmp/redis.tar.tgz \
+ && rm -rf /tmp/redis.tar.tgz \
+ && docker-php-ext-enable redis
+
# Hiredis
-RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.gz \
+RUN wget https://github.com/redis/hiredis/archive/v${HIREDIS_VERSION}.tar.gz -O hiredis.tar.gz \
&& mkdir -p hiredis \
&& tar -xf hiredis.tar.gz -C hiredis --strip-components=1 \
&& rm hiredis.tar.gz \
@@ -47,7 +56,7 @@ RUN wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz -O hiredis.tar.
&& rm -r hiredis
# Swoole extension
-RUN wget https://github.com/swoole/swoole-src/archive/v4.0.1.tar.gz -O swoole.tar.gz \
+RUN wget https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
&& rm swoole.tar.gz \
diff --git a/demo.sql b/demo.sql
new file mode 100644
index 00000000..9f0c0def
--- /dev/null
+++ b/demo.sql
@@ -0,0 +1,16 @@
+CREATE DATABASE IF NOT EXISTS test;
+USE test;
+CREATE TABLE IF NOT EXISTS `user` (
+ `id` INT (11) NOT NULL AUTO_INCREMENT,
+ `name` VARCHAR (20) DEFAULT NULL,
+ `sex` INT (1) NOT NULL DEFAULT '0',
+ `age` INT (1) NOT NULL DEFAULT '0',
+ `description` VARCHAR (240) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE = INNODB DEFAULT CHARSET = utf8 ;
+CREATE TABLE `count` (
+ `uid` INT (11) NOT NULL,
+ `fans` INT (1) NOT NULL DEFAULT '0',
+ `follows` INT (1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`uid`)
+) ENGINE = INNODB DEFAULT CHARSET = utf8 ;
diff --git a/docker-compose.yml b/docker-compose.yml
index 74731cd4..3e27f27d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,12 +1,41 @@
version: '3'
+networks:
+ swoft-network:
+ driver: bridge
services:
+ redis:
+ container_name: docker-compose-swoft-redis
+ image: redis:latest
+ privileged: true
+ ports:
+ - "6379:6379"
+ networks:
+ - swoft-network
+
+ mysql:
+ container_name: docker-compose-swoft-mysql
+ image: mysql:5.6
+ privileged: true
+ ports:
+ - "3306:3306"
+ volumes:
+ - ./demo.sql:/docker-entrypoint-initdb.d/demo.sql
+ environment:
+ MYSQL_ROOT_PASSWORD: 123456
+ networks:
+ - swoft-network
+
swoft:
- container_name: swoft
- image: swoft/swoft
+ container_name: docker-compose-swoft
+ image: swoft/swoft:latest
+# build: ./
ports:
- "80:80"
volumes:
- ./:/var/www/swoft
stdin_open: true
tty: true
+ privileged: true
command: php /var/www/swoft/bin/swoft start
+ networks:
+ - swoft-network
\ No newline at end of file
From a851e6f52cec27b08fbaa4915b8b692ef575e24b Mon Sep 17 00:00:00 2001
From: ccinn <471113744@qq.com>
Date: Thu, 26 Jul 2018 20:02:12 +0800
Subject: [PATCH 259/643] Adjust docker-compose env_file (#325)
---
.env.docker-compose | 8 +++
.env.example.docker-compose | 114 ------------------------------------
docker-compose.yml | 1 +
3 files changed, 9 insertions(+), 114 deletions(-)
create mode 100644 .env.docker-compose
delete mode 100644 .env.example.docker-compose
diff --git a/.env.docker-compose b/.env.docker-compose
new file mode 100644
index 00000000..ce342032
--- /dev/null
+++ b/.env.docker-compose
@@ -0,0 +1,8 @@
+# Database Master nodes
+DB_URI=mysql:3306/test?user=root&password=123456&charset=utf8,mysql:3306/test?user=root&password=123456&charset=utf8
+
+# Database Slave nodes
+DB_SLAVE_URI=mysql:3306/test?user=root&password=123456&charset=utf8,mysql:3306/test?user=root&password=123456&charset=utf8
+
+# Redis
+REDIS_URI=redis:6379,redis:6379
\ No newline at end of file
diff --git a/.env.example.docker-compose b/.env.example.docker-compose
deleted file mode 100644
index 018e67df..00000000
--- a/.env.example.docker-compose
+++ /dev/null
@@ -1,114 +0,0 @@
-# Application
-TIME_ZONE=Asia/Shanghai
-LOG_ENABLE=false
-APP_DEBUG=false
-
-# Server
-PFILE=/tmp/swoft.pid
-PNAME=php-swoft
-TCPABLE=true
-CRONABLE=false
-AUTO_RELOAD=true
-AUTO_REGISTER=false
-
-# HTTP
-HTTP_HOST=0.0.0.0
-HTTP_PORT=80
-HTTP_MODE=SWOOLE_PROCESS
-HTTP_TYPE=SWOOLE_SOCK_TCP
-
-# WebSocket
-WS_ENABLE_HTTP=true
-
-# TCP
-TCP_HOST=0.0.0.0
-TCP_PORT=8099
-TCP_MODE=SWOOLE_PROCESS
-TCP_TYPE=SWOOLE_SOCK_TCP
-TCP_PACKAGE_MAX_LENGTH=2048
-TCP_OPEN_EOF_CHECK=false
-
-# Crontab
-CRONTAB_TASK_COUNT=1024
-CRONTAB_TASK_QUEUE=2048
-
-# Swoole Settings
-WORKER_NUM=1
-MAX_REQUEST=100000
-DAEMONIZE=0
-DISPATCH_MODE=2
-TASK_IPC_MODE=1
-MESSAGE_QUEUE_KEY=1879052289
-TASK_TMPDIR=/tmp/
-LOG_FILE=@runtime/logs/swoole.log
-TASK_WORKER_NUM=1
-PACKAGE_MAX_LENGTH=2048
-OPEN_HTTP2_PROTOCOL=false
-SSL_CERT_FILE=/path/to/ssl_cert_file
-SSL_KEY_FILE=/path/to/ssl_key_file
-
-# Database Master nodes
-DB_NAME=dbMaster
-DB_URI=mysql:3306/test?user=root&password=123456&charset=utf8,mysql:3306/test?user=root&password=123456&charset=utf8
-DB_MIN_ACTIVE=5
-DB_MAX_ACTIVE=10
-DB_MAX_WAIT=20
-DB_MAX_WAIT_TIME=3
-DB_MAX_IDLE_TIME=60
-DB_TIMEOUT=2
-
-# Database Slave nodes
-DB_SLAVE_NAME=dbSlave
-DB_SLAVE_URI=mysql:3306/test?user=root&password=123456&charset=utf8,mysql:3306/test?user=root&password=123456&charset=utf8
-DB_SLAVE_MIN_ACTIVE=5
-DB_SLAVE_MAX_ACTIVE=10
-DB_SLAVE_MAX_WAIT=20
-DB_SLAVE_MAX_WAIT_TIME=3
-DB_SLAVE_MAX_IDLE_TIME=60
-DB_SLAVE_TIMEOUT=3
-
-# Redis
-REDIS_NAME=redis
-REDIS_DB=2
-REDIS_URI=redis:6379,redis:6379
-REDIS_MIN_ACTIVE=5
-REDIS_MAX_ACTIVE=10
-REDIS_MAX_WAIT=20
-REDIS_MAX_WAIT_TIME=3
-REDIS_MAX_IDLE_TIME=60
-REDIS_TIMEOUT=3
-REDIS_SERIALIZE=1
-
-# other redis node
-REDIS_DEMO_REDIS_DB=6
-REDIS_DEMO_REDIS_PREFIX=demo_redis_
-
-# User service (demo service)
-USER_POOL_NAME=user
-USER_POOL_URI=127.0.0.1:8099,127.0.0.1:8099
-USER_POOL_MIN_ACTIVE=5
-USER_POOL_MAX_ACTIVE=10
-USER_POOL_MAX_WAIT=20
-USER_POOL_TIMEOUT=200
-USER_POOL_MAX_WAIT_TIME=3
-USER_POOL_MAX_IDLE_TIME=60
-USER_POOL_USE_PROVIDER=false
-USER_POOL_BALANCER=random
-USER_POOL_PROVIDER=consul
-
-# User service breaker (demo service)
-USER_BREAKER_FAIL_COUNT = 3
-USER_BREAKER_SUCCESS_COUNT = 6
-USER_BREAKER_DELAY_TIME = 5000
-
-# Consul
-CONSUL_ADDRESS=http://127.0.0.1
-CONSUL_PORT=8500
-CONSUL_REGISTER_NAME=user
-CONSUL_REGISTER_ETO=false
-CONSUL_REGISTER_SERVICE_ADDRESS=127.0.0.1
-CONSUL_REGISTER_SERVICE_PORT=8099
-CONSUL_REGISTER_CHECK_NAME=user
-CONSUL_REGISTER_CHECK_TCP=127.0.0.1:8099
-CONSUL_REGISTER_CHECK_INTERVAL=10
-CONSUL_REGISTER_CHECK_TIMEOUT=1
diff --git a/docker-compose.yml b/docker-compose.yml
index 3e27f27d..c62ae0f7 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -33,6 +33,7 @@ services:
- "80:80"
volumes:
- ./:/var/www/swoft
+ env_file: ./.env.docker-compose
stdin_open: true
tty: true
privileged: true
From ac40ffd691349378a63f0d53047f277237a5b812 Mon Sep 17 00:00:00 2001
From: ccinn <471113744@qq.com>
Date: Mon, 30 Jul 2018 21:44:13 +0800
Subject: [PATCH 260/643] transfer https://github.com/swoft-cloud/swoft-docker
(https://github.com/swoft-cloud/swoft/pull/329)
transfer to https://github.com/swoft-cloud/swoft-docker
---
demo.sql | 16 ---------------
docker-compose.yml | 50 ++++++++++------------------------------------
2 files changed, 11 insertions(+), 55 deletions(-)
delete mode 100644 demo.sql
diff --git a/demo.sql b/demo.sql
deleted file mode 100644
index 9f0c0def..00000000
--- a/demo.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE DATABASE IF NOT EXISTS test;
-USE test;
-CREATE TABLE IF NOT EXISTS `user` (
- `id` INT (11) NOT NULL AUTO_INCREMENT,
- `name` VARCHAR (20) DEFAULT NULL,
- `sex` INT (1) NOT NULL DEFAULT '0',
- `age` INT (1) NOT NULL DEFAULT '0',
- `description` VARCHAR (240) DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE = INNODB DEFAULT CHARSET = utf8 ;
-CREATE TABLE `count` (
- `uid` INT (11) NOT NULL,
- `fans` INT (1) NOT NULL DEFAULT '0',
- `follows` INT (1) NOT NULL DEFAULT '0',
- PRIMARY KEY (`uid`)
-) ENGINE = INNODB DEFAULT CHARSET = utf8 ;
diff --git a/docker-compose.yml b/docker-compose.yml
index c62ae0f7..4049efd5 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,42 +1,14 @@
version: '3'
-networks:
- swoft-network:
- driver: bridge
-services:
- redis:
- container_name: docker-compose-swoft-redis
- image: redis:latest
- privileged: true
- ports:
- - "6379:6379"
- networks:
- - swoft-network
-
- mysql:
- container_name: docker-compose-swoft-mysql
- image: mysql:5.6
- privileged: true
- ports:
- - "3306:3306"
- volumes:
- - ./demo.sql:/docker-entrypoint-initdb.d/demo.sql
- environment:
- MYSQL_ROOT_PASSWORD: 123456
- networks:
- - swoft-network
+services:
swoft:
- container_name: docker-compose-swoft
- image: swoft/swoft:latest
-# build: ./
- ports:
- - "80:80"
- volumes:
- - ./:/var/www/swoft
- env_file: ./.env.docker-compose
- stdin_open: true
- tty: true
- privileged: true
- command: php /var/www/swoft/bin/swoft start
- networks:
- - swoft-network
\ No newline at end of file
+ image: swoft/swoft:latest
+# build: ./
+ ports:
+ - "80:80"
+ volumes:
+ - ./:/var/www/swoft
+ stdin_open: true
+ tty: true
+ privileged: true
+ command: php /var/www/swoft/bin/swoft start
\ No newline at end of file
From cac6a7a13ea7b9ff70ea90d0d3616ece2c2159c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Thu, 9 Aug 2018 16:25:32 +0800
Subject: [PATCH 261/643] Update Dockerfile
Upgrade swoole version to 4.0.3
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 4d4d8e32..faefadc4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,7 +5,7 @@ MAINTAINER huangzhhui
# Version
ENV PHPREDIS_VERSION 4.0.0
ENV HIREDIS_VERSION 0.13.3
-ENV SWOOLE_VERSION 4.0.1
+ENV SWOOLE_VERSION 4.0.3
# Timezone
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
From 84930267f49990ef15081d208c9ff8fc9b75ec1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=93=AD=E6=98=95?= <715557344@qq.com>
Date: Thu, 9 Aug 2018 18:18:19 +0800
Subject: [PATCH 262/643] =?UTF-8?q?=E5=A2=9E=E5=8A=A0rpc-client=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=20(#340)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/server.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/config/server.php b/config/server.php
index 0f25c2bc..48eb7b41 100644
--- a/config/server.php
+++ b/config/server.php
@@ -24,6 +24,12 @@
'open_eof_check' => env('TCP_OPEN_EOF_CHECK', false),
'open_eof_split' => env('TCP_OPEN_EOF_SPLIT', true),
'package_eof' => "\r\n",
+ 'client' => [
+ 'package_max_length' => env('TCP_CLIENT_PACKAGE_MAX_LENGTH', 1024 * 1024 * 2),
+ 'open_eof_check' => env('TCP_CLIENT_OPEN_EOF_CHECK', false),
+ 'open_eof_split' => env('TCP_CLIENT_OPEN_EOF_SPLIT', true),
+ 'package_eof' => "\r\n",
+ ],
],
'http' => [
'host' => env('HTTP_HOST', '0.0.0.0'),
From a11300c670e273afe89a3bee62386544ed3a68cc Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 22 Aug 2018 11:14:56 +0800
Subject: [PATCH 263/643] Dockerfile: replace CMD to ENTRYPOINT (#352)
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index faefadc4..df93f8e5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -80,4 +80,4 @@ RUN composer install --no-dev \
EXPOSE 80
-CMD ["php", "/var/www/swoft/bin/swoft", "start"]
+ENTRYPOINT ["php", "/var/www/swoft/bin/swoft", "start"]
From 836691353354c6594864ada104ac8da657d95b3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Sun, 26 Aug 2018 16:33:30 +0800
Subject: [PATCH 264/643] Update composer.json
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index 5c17ff85..cbfbd1a5 100644
--- a/composer.json
+++ b/composer.json
@@ -61,7 +61,7 @@
"repositories": {
"packagist": {
"type": "composer",
- "url": "https://packagist.phpcomposer.com/"
+ "url": "https://packagist.laravel-china.org/"
}
}
}
From b1536f2740520a7efe99a6d94072e90251a44c17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Sun, 26 Aug 2018 16:33:45 +0800
Subject: [PATCH 265/643] Update dev.composer.json
---
dev.composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dev.composer.json b/dev.composer.json
index 51ef7ec4..605367e0 100644
--- a/dev.composer.json
+++ b/dev.composer.json
@@ -65,7 +65,7 @@
},
{
"type": "composer",
- "url": "https://packagist.phpcomposer.com/"
+ "url": "https://packagist.laravel-china.org/"
}
]
}
From 8f7b5f5c0827d67b5164e98fdc524c27ca1909f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Sun, 2 Sep 2018 23:19:48 +0800
Subject: [PATCH 266/643] Update changelog.md
---
changelog.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/changelog.md b/changelog.md
index 84fb4b71..e7e64f64 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,12 @@
# Change log
+# 2018-08-15
+* 增加自定义组件支持
+
+# 2018-08-07
+* 适配 Swoole 4.0.3 协程API变更
+* 加强 RpcClient 的自定义配置的能力
+
# 2018-04-05
* 添加 websocket 支持
From 653d7d8c2fe386832ebed426b5e39e020617cc0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Sun, 2 Sep 2018 23:21:02 +0800
Subject: [PATCH 267/643] Update changelog.md
---
changelog.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/changelog.md b/changelog.md
index e7e64f64..7ea1dddc 100644
--- a/changelog.md
+++ b/changelog.md
@@ -6,6 +6,7 @@
# 2018-08-07
* 适配 Swoole 4.0.3 协程API变更
* 加强 RpcClient 的自定义配置的能力
+* 完善 Redis 的命令支持
# 2018-04-05
From 4df614a368bdd30c54a48ed19e0eb60dc17ef40a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=93=AD=E6=98=95?= <715557344@qq.com>
Date: Wed, 5 Sep 2018 14:52:31 +0800
Subject: [PATCH 268/643] =?UTF-8?q?=E4=BF=AE=E6=94=B9pfile=E9=BB=98?=
=?UTF-8?q?=E8=AE=A4=E4=BD=8D=E7=BD=AE=20(https://github.com/swoft-cloud/s?=
=?UTF-8?q?woft/pull/375)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
支持别名配置
---
.env.example | 2 +-
config/server.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.env.example b/.env.example
index 6981ef25..74c94abe 100644
--- a/.env.example
+++ b/.env.example
@@ -4,7 +4,7 @@ LOG_ENABLE=false
APP_DEBUG=false
# Server
-PFILE=/tmp/swoft.pid
+PFILE=@runtime/swoft.pid
PNAME=php-swoft
TCPABLE=true
CRONABLE=false
diff --git a/config/server.php b/config/server.php
index 48eb7b41..abc674ea 100644
--- a/config/server.php
+++ b/config/server.php
@@ -9,7 +9,7 @@
return [
'server' => [
- 'pfile' => env('PFILE', '/tmp/swoft.pid'),
+ 'pfile' => alias(env('PFILE', '@runtime/swoft.pid')),
'pname' => env('PNAME', 'php-swoft'),
'tcpable' => env('TCPABLE', true),
'cronable' => env('CRONABLE', false),
From ec8e65f3f489d82176eecc8c994c906295cf4191 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 12 Sep 2018 11:53:54 +0800
Subject: [PATCH 269/643] fix: cannot override Dockerfile startup command
(#385)
---
docker-compose.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker-compose.yml b/docker-compose.yml
index 4049efd5..c912a751 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -11,4 +11,4 @@ services:
stdin_open: true
tty: true
privileged: true
- command: php /var/www/swoft/bin/swoft start
\ No newline at end of file
+ entrypoint: ["php", "/var/www/swoft/bin/swoft", "start"]
From a8f97a81e5743cd1b4b82e9a5cc129f411b9f2ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Fri, 14 Sep 2018 23:47:28 +0800
Subject: [PATCH 270/643] Update composer.json
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index cbfbd1a5..4056611f 100644
--- a/composer.json
+++ b/composer.json
@@ -6,7 +6,7 @@
"swoole",
"swoft"
],
- "description": "Modern High performance AOP and Coroutine PHP Framework, base on Swoole 2",
+ "description": "Modern High performance AOP and Coroutine PHP Framework, base on Swoole",
"license": "Apache-2.0",
"require": {
"php": ">=7.0",
From 05a048180716d896f7ed450ef19ab8dcf8561bc7 Mon Sep 17 00:00:00 2001
From: SAMUEL NELA
Date: Wed, 19 Sep 2018 04:11:36 +0200
Subject: [PATCH 271/643] Defined class as abstract (#390)
---
test/Cases/AbstractTestCase.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/Cases/AbstractTestCase.php b/test/Cases/AbstractTestCase.php
index f29c922d..848ac0dd 100644
--- a/test/Cases/AbstractTestCase.php
+++ b/test/Cases/AbstractTestCase.php
@@ -23,7 +23,7 @@
*
* @package Swoft\Test\Cases
*/
-class AbstractTestCase extends TestCase
+abstract class AbstractTestCase extends TestCase
{
const ACCEPT_VIEW = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8';
const ACCEPT_JSON = 'application/json';
@@ -184,4 +184,4 @@ protected function buildMockRequest(
$swooleRequest->get = array_merge($urlParams, $get);
}
}
-}
\ No newline at end of file
+}
From 7461231ee532e14856c18938793a7e418aee9a5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Mon, 1 Oct 2018 16:36:02 +0800
Subject: [PATCH 272/643] Update README.md
---
README.md | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 87cfd78d..cb982fa9 100644
--- a/README.md
+++ b/README.md
@@ -19,8 +19,8 @@
The first high-performance PHP coroutine full-stack componentization framework based on Swoole native coroutine, built-in coroutine web server and commonly-used coroutine client, resident memory, which has no dependency on PHP-FPM, asynchronous non-blocking IO implementation, similar to synchronous client style of writing to achieve the use of asynchronous clients, without complex asynchronous callback, no tedious yield, similar Go language coroutines, flexible annotations framework, a powerful global dependency injection container base on annotations, and great service governance , flexible and powerful AOP, PSR specification implementation, etc., could be used to build high-performance Web systems, APIs, middleware, basic services, microservice and so on.
- Base on Swoole extension
-- Built-in HTTP, TCP, WebSocket Server
-- Poweful AOP (Aspect Oriented Programming)
+- Built-in HTTP, TCP, WebSocket Coroutine Server
+- Powerful AOP (Aspect Oriented Programming)
- Flexible and comprehensive annotations framework
- Global dependency injection container
- PSR-7 based HTTP message implementation
@@ -28,34 +28,34 @@ The first high-performance PHP coroutine full-stack componentization framework b
- PSR-15 based middleware
- PSR-16 based cache design
- Scalable high performance RPC
-- Great service governance, fallback, load balance, service registration and discovery
+- Holistic service governance, fallback, load balance, service registration and discovery
- Database ORM
-- Universal connection pool
+- Universal connection pools
- Mysql, Redis, RPC, HTTP Coroutine Clients
- Coroutine driver client and blocking driver client seamlessly switch automatically
- Coroutine and asynchronous task delivery
-- Custom user process
-- RESTful support
-- Internationalization (i18n) support
+- Custom user processes
+- RESTful supported
+- Internationalization (i18n) supported
- High performance router
- Fast and flexible parameter validator
- Alias mechanism
- Powerful log component
-- Cross-platform application auto-reload
+- Cross-platform application auto-reload mechanism
## Document
[**Chinese Document**](https://doc.swoft.org)
-[**English Document**](https://doc.swoft.org) Not yet, please help us write it.
+[**English Document**](https://doc.swoft.org) Not yet, please help us to complete it.
-QQ Group1: 548173319(Full)
+QQ Group1: 548173319
QQ Group2: 778656850
## Environmental Requirements
1. PHP 7.0 +
-2. [Swoole 2.1.3](https://github.com/swoole/swoole-src/releases) +, *coroutine* and *async redis client* options are required
+2. [Swoole 2.1.3](https://github.com/swoole/swoole-src/releases) + ( >= 4.1 is better), *coroutine* and *async redis client* options are required
3. [Hiredis](https://github.com/redis/hiredis/releases)
4. [Composer](https://getcomposer.org/)
@@ -81,7 +81,7 @@ QQ Group2: 778656850
## Configuration
-If automatically copied `.env` file fails when `composer install` was executed, the `.env.example` that in root directory can be manually copied and named `.env`. Note that `composer update` will not trigger related copy operations.
+If automatically copied `.env` file operation fails when `composer install` was executed, the `.env.example` that in root directory can be manually copied and named `.env`. Note that `composer update` will not trigger related copy operations.
```
# Server
From df5839b3f29e50cc4008e04b8281964d2f41b947 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Wed, 24 Oct 2018 13:24:58 +0800
Subject: [PATCH 273/643] add custom function file (#418)
* add custom function file
* Update dev.composer.json
* Create functions.php
* Rename functions.php to Functions.php
* Update composer.json
* Update dev.composer.json
---
app/Helper/Functions.php | 12 ++++++++++++
composer.json | 3 ++-
dev.composer.json | 3 ++-
3 files changed, 16 insertions(+), 2 deletions(-)
create mode 100644 app/Helper/Functions.php
diff --git a/app/Helper/Functions.php b/app/Helper/Functions.php
new file mode 100644
index 00000000..aa2e8e7a
--- /dev/null
+++ b/app/Helper/Functions.php
@@ -0,0 +1,12 @@
+
Date: Wed, 31 Oct 2018 18:28:59 +0800
Subject: [PATCH 274/643] Update ExceptionController.php (#433)
spelling mistake.
---
app/Controllers/ExceptionController.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Controllers/ExceptionController.php b/app/Controllers/ExceptionController.php
index c4de3dba..ba12d69f 100644
--- a/app/Controllers/ExceptionController.php
+++ b/app/Controllers/ExceptionController.php
@@ -25,7 +25,7 @@ class ExceptionController
* @RequestMapping()
* @throws \Exception
*/
- public function exceptioin()
+ public function exception()
{
throw new \Exception('this is exception');
}
@@ -56,4 +56,4 @@ public function viewException()
{
throw new BadMethodCallException('view exception! ');
}
-}
\ No newline at end of file
+}
From 71bd72fb0d8b2c339d40cb648eb98a2a2e6cee40 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Sat, 15 Dec 2018 09:55:35 +0800
Subject: [PATCH 275/643] fix: exclude scann app/Helpler (#495)
---
config/properties/app.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/properties/app.php b/config/properties/app.php
index 31ee66e9..13b07361 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -17,7 +17,7 @@
'App\Boot',
],
'excludeScan' => [
-
+ 'App\Helper',
],
'I18n' => [
'sourceLanguage' => '@root/resources/messages/',
From 1f8b791094207fa43921c39bc3426032364a5234 Mon Sep 17 00:00:00 2001
From: Wfuren
Date: Sat, 15 Dec 2018 16:59:55 +0800
Subject: [PATCH 276/643] Update app.php (#497)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
修复I18n默认指向目录错误
---
config/properties/app.php | 2 +-
resources/README.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/properties/app.php b/config/properties/app.php
index 13b07361..9a8aa450 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -20,7 +20,7 @@
'App\Helper',
],
'I18n' => [
- 'sourceLanguage' => '@root/resources/messages/',
+ 'sourceLanguage' => '@resources/languages/',
],
'db' => require __DIR__ . DS . 'db.php',
'cache' => require __DIR__ . DS . 'cache.php',
diff --git a/resources/README.md b/resources/README.md
index e2323396..3e92d63d 100644
--- a/resources/README.md
+++ b/resources/README.md
@@ -1,4 +1,4 @@
# 资源目录
- views - 视图资源
-- messages - 翻译资源
\ No newline at end of file
+- languages - 翻译资源
From 189c62e39a8cd5fd7f374eec5baf2e1d2a9f0783 Mon Sep 17 00:00:00 2001
From: Inhere
Date: Fri, 28 Dec 2018 10:42:32 +0800
Subject: [PATCH 277/643] fix:lang config is error (#523)
---
config/properties/app.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/properties/app.php b/config/properties/app.php
index 9a8aa450..605d0d87 100644
--- a/config/properties/app.php
+++ b/config/properties/app.php
@@ -19,8 +19,8 @@
'excludeScan' => [
'App\Helper',
],
- 'I18n' => [
- 'sourceLanguage' => '@resources/languages/',
+ 'translator' => [
+ 'languageDir' => '@resources/languages/',
],
'db' => require __DIR__ . DS . 'db.php',
'cache' => require __DIR__ . DS . 'cache.php',
From 7dc5773c9f3613abe16c567d8c961baf83e2e396 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Sat, 5 Jan 2019 12:10:34 +0800
Subject: [PATCH 278/643] add
---
.env.example | 114 ++++++++++++++++++++++++++++++++++
.github/CODE_OF_CONDUCT.md | 12 ++++
.github/ISSUE_TEMPLATE.md | 23 +++++++
.gitignore | 14 +++++
app/Application.php | 18 ++++++
app/AutoLoader.php | 23 +++++++
app/Helper/Functions.php | 2 +
app/Model/Dao/DemoDao.php | 13 ++++
app/Model/Data/DemoData.php | 19 ++++++
app/Model/Logic/DemoLogic.php | 19 ++++++
app/bean.php | 4 ++
bin/bootstrap.php | 12 ++++
bin/swoft | 11 ++++
composer.json | 80 ++++++++++++++++++++++++
config/base.php | 4 ++
config/db.php | 4 ++
16 files changed, 372 insertions(+)
create mode 100644 .env.example
create mode 100644 .github/CODE_OF_CONDUCT.md
create mode 100644 .github/ISSUE_TEMPLATE.md
create mode 100644 .gitignore
create mode 100644 app/Application.php
create mode 100644 app/AutoLoader.php
create mode 100644 app/Helper/Functions.php
create mode 100644 app/Model/Dao/DemoDao.php
create mode 100644 app/Model/Data/DemoData.php
create mode 100644 app/Model/Logic/DemoLogic.php
create mode 100644 app/bean.php
create mode 100644 bin/bootstrap.php
create mode 100644 bin/swoft
create mode 100644 composer.json
create mode 100644 config/base.php
create mode 100644 config/db.php
diff --git a/.env.example b/.env.example
new file mode 100644
index 00000000..74c94abe
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,114 @@
+# Application
+TIME_ZONE=Asia/Shanghai
+LOG_ENABLE=false
+APP_DEBUG=false
+
+# Server
+PFILE=@runtime/swoft.pid
+PNAME=php-swoft
+TCPABLE=true
+CRONABLE=false
+AUTO_RELOAD=true
+AUTO_REGISTER=false
+
+# HTTP
+HTTP_HOST=0.0.0.0
+HTTP_PORT=80
+HTTP_MODE=SWOOLE_PROCESS
+HTTP_TYPE=SWOOLE_SOCK_TCP
+
+# WebSocket
+WS_ENABLE_HTTP=true
+
+# TCP
+TCP_HOST=0.0.0.0
+TCP_PORT=8099
+TCP_MODE=SWOOLE_PROCESS
+TCP_TYPE=SWOOLE_SOCK_TCP
+TCP_PACKAGE_MAX_LENGTH=2048
+TCP_OPEN_EOF_CHECK=false
+
+# Crontab
+CRONTAB_TASK_COUNT=1024
+CRONTAB_TASK_QUEUE=2048
+
+# Swoole Settings
+WORKER_NUM=1
+MAX_REQUEST=100000
+DAEMONIZE=0
+DISPATCH_MODE=2
+TASK_IPC_MODE=1
+MESSAGE_QUEUE_KEY=1879052289
+TASK_TMPDIR=/tmp/
+LOG_FILE=@runtime/logs/swoole.log
+TASK_WORKER_NUM=1
+PACKAGE_MAX_LENGTH=2048
+OPEN_HTTP2_PROTOCOL=false
+SSL_CERT_FILE=/path/to/ssl_cert_file
+SSL_KEY_FILE=/path/to/ssl_key_file
+
+# Database Master nodes
+DB_NAME=dbMaster
+DB_URI=127.0.0.1:3306/test?user=root&password=123456&charset=utf8,127.0.0.1:3306/test?user=root&password=123456&charset=utf8
+DB_MIN_ACTIVE=5
+DB_MAX_ACTIVE=10
+DB_MAX_WAIT=20
+DB_MAX_WAIT_TIME=3
+DB_MAX_IDLE_TIME=60
+DB_TIMEOUT=2
+
+# Database Slave nodes
+DB_SLAVE_NAME=dbSlave
+DB_SLAVE_URI=127.0.0.1:3306/test?user=root&password=123456&charset=utf8,127.0.0.1:3306/test?user=root&password=123456&charset=utf8
+DB_SLAVE_MIN_ACTIVE=5
+DB_SLAVE_MAX_ACTIVE=10
+DB_SLAVE_MAX_WAIT=20
+DB_SLAVE_MAX_WAIT_TIME=3
+DB_SLAVE_MAX_IDLE_TIME=60
+DB_SLAVE_TIMEOUT=3
+
+# Redis
+REDIS_NAME=redis
+REDIS_DB=2
+REDIS_URI=127.0.0.1:6379,127.0.0.1:6379
+REDIS_MIN_ACTIVE=5
+REDIS_MAX_ACTIVE=10
+REDIS_MAX_WAIT=20
+REDIS_MAX_WAIT_TIME=3
+REDIS_MAX_IDLE_TIME=60
+REDIS_TIMEOUT=3
+REDIS_SERIALIZE=1
+
+# other redis node
+REDIS_DEMO_REDIS_DB=6
+REDIS_DEMO_REDIS_PREFIX=demo_redis_
+
+# User service (demo service)
+USER_POOL_NAME=user
+USER_POOL_URI=127.0.0.1:8099,127.0.0.1:8099
+USER_POOL_MIN_ACTIVE=5
+USER_POOL_MAX_ACTIVE=10
+USER_POOL_MAX_WAIT=20
+USER_POOL_TIMEOUT=200
+USER_POOL_MAX_WAIT_TIME=3
+USER_POOL_MAX_IDLE_TIME=60
+USER_POOL_USE_PROVIDER=false
+USER_POOL_BALANCER=random
+USER_POOL_PROVIDER=consul
+
+# User service breaker (demo service)
+USER_BREAKER_FAIL_COUNT = 3
+USER_BREAKER_SUCCESS_COUNT = 6
+USER_BREAKER_DELAY_TIME = 5000
+
+# Consul
+CONSUL_ADDRESS=http://127.0.0.1
+CONSUL_PORT=8500
+CONSUL_REGISTER_NAME=user
+CONSUL_REGISTER_ETO=false
+CONSUL_REGISTER_SERVICE_ADDRESS=127.0.0.1
+CONSUL_REGISTER_SERVICE_PORT=8099
+CONSUL_REGISTER_CHECK_NAME=user
+CONSUL_REGISTER_CHECK_TCP=127.0.0.1:8099
+CONSUL_REGISTER_CHECK_INTERVAL=10
+CONSUL_REGISTER_CHECK_TIMEOUT=1
diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..c2a23273
--- /dev/null
+++ b/.github/CODE_OF_CONDUCT.md
@@ -0,0 +1,12 @@
+Contributor Code of Conduct
+As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
+
+We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
+
+Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
+
+This Code of Conduct is adapted from the Contributor Covenant, version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 00000000..be97a863
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,23 @@
+| Q | A
+| ------------------- | -----
+| Bug report? | yes/no
+| Feature request? | yes/no
+| Swoft version | x.y.z
+| Swoole version | x.y.z (by `php --ri swoole`)
+| PHP version | x.y.z (by `php -v`)
+| Runtime environment | Win10/Mac/CentOS 7/Ubuntu/Docker etc.
+
+**Details**
+
+> Describe what you are trying to achieve and what goes wrong.
+
+```php
+// paste output here
+```
+
+> Provide minimal script to reproduce the issue
+
+```php
+// paste code
+```
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..610d543f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+.buildpath
+.settings/
+.project
+*.patch
+.idea/
+.git/
+runtime/
+vendor/
+temp/
+*.lock
+.phpintel/
+.env
+.DS_Store
+public/devtool/
\ No newline at end of file
diff --git a/app/Application.php b/app/Application.php
new file mode 100644
index 00000000..2d01ddb4
--- /dev/null
+++ b/app/Application.php
@@ -0,0 +1,18 @@
+ __DIR__,
+ ];
+ }
+}
\ No newline at end of file
diff --git a/app/Helper/Functions.php b/app/Helper/Functions.php
new file mode 100644
index 00000000..a4abe2da
--- /dev/null
+++ b/app/Helper/Functions.php
@@ -0,0 +1,2 @@
+run();
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 00000000..ab882bb6
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,80 @@
+{
+ "name": "swoft/swoft",
+ "type": "project",
+ "keywords": [
+ "php",
+ "swoole",
+ "swoft"
+ ],
+ "description": "Modern High performance AOP and Coroutine PHP Framework, base on Swoole",
+ "license": "Apache-2.0",
+ "require": {
+ "php": ">=7.1",
+ "swoft/core": "dev-master",
+ "swoft/annotation": "dev-master",
+ "swoft/bean": "dev-master",
+ "swoft/event": "dev-master",
+ "swoft/aop": "dev-master",
+ "swoft/config": "dev-master",
+ "swoft/stdlib": "dev-master",
+ "swoft/log": "dev-master"
+ },
+ "require-dev": {
+ "swoft/swoole-ide-helper": "dev-master",
+ "phpunit/phpunit": "^5.7",
+ "friendsofphp/php-cs-fixer": "^2.10",
+ "psy/psysh": "@stable"
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "app/"
+ },
+ "files": [
+ "app/Helper/Functions.php"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ }
+ },
+ "scripts": {
+ },
+ "repositories": [
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-core.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-annotation.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-bean.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-event.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-aop.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-config.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-log.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-stdlib.git"
+ },
+ {
+ "type": "composer",
+ "url": "https://packagist.laravel-china.org/"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/config/base.php b/config/base.php
new file mode 100644
index 00000000..05e0b10e
--- /dev/null
+++ b/config/base.php
@@ -0,0 +1,4 @@
+
Date: Mon, 7 Jan 2019 00:43:01 +0800
Subject: [PATCH 279/643] add test
---
app/Model/Logic/DemoLogic.php | 2 +-
config/base.php | 2 +-
config/db.php | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/Model/Logic/DemoLogic.php b/app/Model/Logic/DemoLogic.php
index 6847d247..0d73f263 100644
--- a/app/Model/Logic/DemoLogic.php
+++ b/app/Model/Logic/DemoLogic.php
@@ -2,8 +2,8 @@
namespace App\Model\Logic;
-use Swoft\Bean\Annotation\Mapping\Bean;
use App\Model\Data\DemoData;
+use Swoft\Bean\Annotation\Mapping\Bean;
use Swoft\Bean\Annotation\Mapping\Inject;
/**
diff --git a/config/base.php b/config/base.php
index 05e0b10e..5ac7cee8 100644
--- a/config/base.php
+++ b/config/base.php
@@ -1,4 +1,4 @@
'stelin'
];
\ No newline at end of file
diff --git a/config/db.php b/config/db.php
index 05e0b10e..f03cc1a8 100644
--- a/config/db.php
+++ b/config/db.php
@@ -1,4 +1,4 @@
'host'
];
\ No newline at end of file
From 563db3eb4e8e92912ab4eef058b5422618494c4a Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Thu, 10 Jan 2019 17:20:35 +0800
Subject: [PATCH 280/643] parse object definition by annotation and definition
---
app/Model/Logic/DemoLogic.php | 53 ++++++++++++++++++++++++++++++++++-
app/bean.php | 9 +++++-
2 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/app/Model/Logic/DemoLogic.php b/app/Model/Logic/DemoLogic.php
index 0d73f263..f9e05048 100644
--- a/app/Model/Logic/DemoLogic.php
+++ b/app/Model/Logic/DemoLogic.php
@@ -7,7 +7,7 @@
use Swoft\Bean\Annotation\Mapping\Inject;
/**
- * @Bean()
+ * @Bean(alias="deloc")
*/
class DemoLogic
{
@@ -16,4 +16,55 @@ class DemoLogic
* @var DemoData
*/
private $data;
+
+ /**
+ * @var string
+ */
+ private $definitionData;
+
+ /**
+ * @var string
+ */
+ private $name;
+
+ /**
+ * @var int
+ */
+ private $type = 0;
+
+ /**
+ * @var DemoData
+ */
+ private $construnctData;
+
+ /**
+ * DemoLogic constructor.
+ *
+ * @param string $name
+ * @param string $type
+ * @param DemoData
+ */
+ public function __construct(string $name, string $type, DemoData $data)
+ {
+ $this->name = $name;
+ $this->type = $type;
+
+ $this->construnctData = $data;
+ }
+
+ /**
+ * @return DemoData
+ */
+ public function getData(): DemoData
+ {
+ return $this->data;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDefinitionData(): string
+ {
+ return $this->definitionData;
+ }
}
\ No newline at end of file
diff --git a/app/bean.php b/app/bean.php
index 05e0b10e..d7201790 100644
--- a/app/bean.php
+++ b/app/bean.php
@@ -1,4 +1,11 @@
[
+ [
+ 'dDname',
+ 12,
+ '${\App\Model\Data\DemoData}'
+ ],
+ 'definitionData' => 'definitionData...'
+ ]
];
\ No newline at end of file
From 730bf18fa220ac985eab46aa705cf640a7fa1b20 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Sun, 13 Jan 2019 18:56:38 +0800
Subject: [PATCH 281/643] config and bean
---
app/Model/Dao/DemoDao.php | 4 ++++
app/Model/Data/DemoData.php | 6 ++++++
app/Model/Logic/DemoLogic.php | 21 ++++++++++++++++++++-
app/bean.php | 2 +-
config/base.php | 2 +-
config/db.php | 2 +-
6 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/app/Model/Dao/DemoDao.php b/app/Model/Dao/DemoDao.php
index 92ae4771..379f8904 100644
--- a/app/Model/Dao/DemoDao.php
+++ b/app/Model/Dao/DemoDao.php
@@ -10,4 +10,8 @@
class DemoDao
{
+ public function get()
+ {
+ echo 'dao get' . PHP_EOL;
+ }
}
\ No newline at end of file
diff --git a/app/Model/Data/DemoData.php b/app/Model/Data/DemoData.php
index 02201737..862572e2 100644
--- a/app/Model/Data/DemoData.php
+++ b/app/Model/Data/DemoData.php
@@ -16,4 +16,10 @@ class DemoData
* @var DemoDao
*/
private $dao;
+
+ public function getDao()
+ {
+ echo 'data getDao'.PHP_EOL;
+ $this->dao->get();
+ }
}
\ No newline at end of file
diff --git a/app/Model/Logic/DemoLogic.php b/app/Model/Logic/DemoLogic.php
index f9e05048..e4d8c2a6 100644
--- a/app/Model/Logic/DemoLogic.php
+++ b/app/Model/Logic/DemoLogic.php
@@ -5,6 +5,7 @@
use App\Model\Data\DemoData;
use Swoft\Bean\Annotation\Mapping\Bean;
use Swoft\Bean\Annotation\Mapping\Inject;
+use Swoft\Config\Annotation\Config;
/**
* @Bean(alias="deloc")
@@ -37,6 +38,18 @@ class DemoLogic
*/
private $construnctData;
+ /**
+ * @Config("name")
+ * @var string
+ */
+ private $configName = '';
+
+ /**
+ * @Config("db.host")
+ * @var string
+ */
+ private $configHost = '';
+
/**
* DemoLogic constructor.
*
@@ -57,7 +70,13 @@ public function __construct(string $name, string $type, DemoData $data)
*/
public function getData(): DemoData
{
- return $this->data;
+ $this->data->getDao();
+ echo 'name=' . $this->name . PHP_EOL;
+ echo 'type=' . $this->type . PHP_EOL;
+ echo 'configName=' . $this->configName . PHP_EOL;
+ echo 'configHost=' . $this->configHost . PHP_EOL;
+
+ return $this->construnctData;
}
/**
diff --git a/app/bean.php b/app/bean.php
index d7201790..3aa9a161 100644
--- a/app/bean.php
+++ b/app/bean.php
@@ -4,7 +4,7 @@
[
'dDname',
12,
- '${\App\Model\Data\DemoData}'
+ '${App\Model\Data\DemoData}'
],
'definitionData' => 'definitionData...'
]
diff --git a/config/base.php b/config/base.php
index 5ac7cee8..7b8e33db 100644
--- a/config/base.php
+++ b/config/base.php
@@ -1,4 +1,4 @@
'stelin'
+ 'name' => 'swoft framework 2.0'
];
\ No newline at end of file
diff --git a/config/db.php b/config/db.php
index f03cc1a8..35b17338 100644
--- a/config/db.php
+++ b/config/db.php
@@ -1,4 +1,4 @@
'host'
+ 'host' => 'http://127.0.0.0.1'
];
\ No newline at end of file
From 32c8dba758cb6bff6e71e07ff96cebb372c7d134 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E6=9C=9D=E6=99=96?=
Date: Wed, 16 Jan 2019 19:11:48 +0800
Subject: [PATCH 282/643] Set enable_static_handler default value to false
---
config/server.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/server.php b/config/server.php
index abc674ea..f399161f 100644
--- a/config/server.php
+++ b/config/server.php
@@ -57,7 +57,7 @@
'package_max_length' => env('PACKAGE_MAX_LENGTH', 2048),
'upload_tmp_dir' => env('UPLOAD_TMP_DIR', '@runtime/uploadfiles'),
'document_root' => env('DOCUMENT_ROOT', BASE_PATH . '/public'),
- 'enable_static_handler' => env('ENABLE_STATIC_HANDLER', true),
+ 'enable_static_handler' => env('ENABLE_STATIC_HANDLER', false),
'open_http2_protocol' => env('OPEN_HTTP2_PROTOCOL', false),
'ssl_cert_file' => env('SSL_CERT_FILE', ''),
'ssl_key_file' => env('SSL_KEY_FILE', ''),
From 56bf61c7f916782c78ff7a83374491d5fec29459 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Sat, 19 Jan 2019 17:05:47 +0800
Subject: [PATCH 283/643] mv core to framework
---
app/Application.php | 2 +-
bin/bootstrap.php | 3 +++
composer.json | 32 +++++++++++++++++++++++++++++++-
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/app/Application.php b/app/Application.php
index 2d01ddb4..90779854 100644
--- a/app/Application.php
+++ b/app/Application.php
@@ -3,7 +3,7 @@
namespace App;
-use Swoft\Core\SwoftApplication;
+use Swoft\SwoftApplication;
/**
* Application
diff --git a/bin/bootstrap.php b/bin/bootstrap.php
index 360efb96..fd237ed0 100644
--- a/bin/bootstrap.php
+++ b/bin/bootstrap.php
@@ -8,5 +8,8 @@
// Project config path
!defined('CONFIG_PATH') && define('CONFIG_PATH', BASE_PATH . '/config');
+// Project runtime path
+!defined('RUNTIME_PATH') && define('RUNTIME_PATH', BASE_PATH . '/runtime');
+
// Composer autoload
require_once BASE_PATH . '/vendor/autoload.php';
\ No newline at end of file
diff --git a/composer.json b/composer.json
index ab882bb6..afdb32e3 100644
--- a/composer.json
+++ b/composer.json
@@ -17,11 +17,17 @@
"swoft/aop": "dev-master",
"swoft/config": "dev-master",
"swoft/stdlib": "dev-master",
+ "swoft/framework": "2.0.x-dev",
+ "swoft/http-message": "2.0.x-dev",
+ "swoft/server": "dev-master",
+ "swoft/tcp-server": "dev-master",
+ "swoft/http-server": "2.0.x-dev",
+ "swoft/websocket-server": "2.0.x-dev",
"swoft/log": "dev-master"
},
"require-dev": {
"swoft/swoole-ide-helper": "dev-master",
- "phpunit/phpunit": "^5.7",
+ "phpunit/phpunit": "^7.5",
"friendsofphp/php-cs-fixer": "^2.10",
"psy/psysh": "@stable"
},
@@ -72,6 +78,30 @@
"type": "git",
"url": "git@github.com:swoft-cloud/swoft-stdlib.git"
},
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-framework.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-http-message.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-server.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-tcp-server.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-http-server.git"
+ },
+ {
+ "type": "git",
+ "url": "git@github.com:swoft-cloud/swoft-websocket-server.git"
+ },
{
"type": "composer",
"url": "https://packagist.laravel-china.org/"
From bdfa2a90488b69662ddcf48b7f8279c3eab80e9b Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Mon, 21 Jan 2019 14:46:34 +0800
Subject: [PATCH 284/643] add file
---
app/Controller/TestController.php | 16 ++++++++++++++++
bin/test.php | 17 +++++++++++++++++
composer.json | 3 +++
3 files changed, 36 insertions(+)
create mode 100644 app/Controller/TestController.php
create mode 100644 bin/test.php
diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php
new file mode 100644
index 00000000..52799e51
--- /dev/null
+++ b/app/Controller/TestController.php
@@ -0,0 +1,16 @@
+=7.1",
+ "psr/http-message": "^1.0",
+ "psr/http-server-handler": "^1.0",
+ "psr/http-server-middleware": "^1.0",
"swoft/core": "dev-master",
"swoft/annotation": "dev-master",
"swoft/bean": "dev-master",
From ecafbe485319cc8b7fb51911d249cf8f697b79ff Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Mon, 21 Jan 2019 17:23:11 +0800
Subject: [PATCH 285/643] modify composer.json
---
composer.json | 82 ++++++++++-----------------------------------------
1 file changed, 15 insertions(+), 67 deletions(-)
diff --git a/composer.json b/composer.json
index 097e7ad2..e588cb13 100644
--- a/composer.json
+++ b/composer.json
@@ -13,20 +13,20 @@
"psr/http-message": "^1.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
- "swoft/core": "dev-master",
- "swoft/annotation": "dev-master",
- "swoft/bean": "dev-master",
- "swoft/event": "dev-master",
- "swoft/aop": "dev-master",
- "swoft/config": "dev-master",
- "swoft/stdlib": "dev-master",
- "swoft/framework": "2.0.x-dev",
- "swoft/http-message": "2.0.x-dev",
- "swoft/server": "dev-master",
- "swoft/tcp-server": "dev-master",
- "swoft/http-server": "2.0.x-dev",
- "swoft/websocket-server": "2.0.x-dev",
- "swoft/log": "dev-master"
+ "swoft/annotation": "^2.0",
+ "swoft/bean": "^2.0",
+ "swoft/event": "^2.0",
+ "swoft/aop": "^2.0",
+ "swoft/config": "^2.0",
+ "swoft/stdlib": "^2.0",
+ "swoft/framework": "^2.0",
+ "swoft/http-message": "^2.0",
+ "swoft/server": "^2.0",
+ "swoft/tcp-server": "^2.0",
+ "swoft/http-server": "^2.0",
+ "swoft/websocket-server": "^2.0",
+ "swoft/log": "^2.0",
+ "swoft/component": "2.0.x-dev as 2.0"
},
"require-dev": {
"swoft/swoole-ide-helper": "dev-master",
@@ -51,59 +51,7 @@
"repositories": [
{
"type": "git",
- "url": "git@github.com:swoft-cloud/swoft-core.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-annotation.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-bean.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-event.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-aop.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-config.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-log.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-stdlib.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-framework.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-http-message.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-server.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-tcp-server.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-http-server.git"
- },
- {
- "type": "git",
- "url": "git@github.com:swoft-cloud/swoft-websocket-server.git"
+ "url": "git@github.com:swoft-cloud/swoft-component.git"
},
{
"type": "composer",
From bb24552b6e8dd12f223929f8022253e5c6422cc5 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Tue, 22 Jan 2019 16:26:26 +0800
Subject: [PATCH 286/643] add
---
bin/swoft | 4 +---
bin/test.php | 19 +++++++++----------
composer.json | 3 ---
3 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/bin/swoft b/bin/swoft
index 99e0cfef..c2db65b6 100644
--- a/bin/swoft
+++ b/bin/swoft
@@ -1,7 +1,5 @@
#!/usr/bin/env php
-__proxyCall('Swoft\\Tcp\\Server\\Swoole\\ConnectListener', 'onConnect', func_get_args());
}
-
}
-echo Test::getAb();
\ No newline at end of file
+
diff --git a/composer.json b/composer.json
index e588cb13..bd67a946 100644
--- a/composer.json
+++ b/composer.json
@@ -10,9 +10,6 @@
"license": "Apache-2.0",
"require": {
"php": ">=7.1",
- "psr/http-message": "^1.0",
- "psr/http-server-handler": "^1.0",
- "psr/http-server-middleware": "^1.0",
"swoft/annotation": "^2.0",
"swoft/bean": "^2.0",
"swoft/event": "^2.0",
From dc1ebc9311bc543e2d12fd5f2fbb82c66270b786 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Wed, 23 Jan 2019 17:53:44 +0800
Subject: [PATCH 287/643] add tsting
---
app/Aspect/LogAspect.php | 78 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 app/Aspect/LogAspect.php
diff --git a/app/Aspect/LogAspect.php b/app/Aspect/LogAspect.php
new file mode 100644
index 00000000..511625e2
--- /dev/null
+++ b/app/Aspect/LogAspect.php
@@ -0,0 +1,78 @@
+test .= ' before1 ';
+ }
+
+ /**
+ * @After()
+ */
+ public function after()
+ {
+ $this->test .= ' after1 ';
+ }
+
+ /**
+ * @AfterReturning()
+ */
+ public function afterReturn(JoinPoint $joinPoint)
+ {
+ $result = $joinPoint->getReturn();
+ return $result . ' afterReturn1 ';
+ }
+
+ /**
+ * @Around()
+ * @param ProceedingJoinPoint $proceedingJoinPoint
+ *
+ * @return mixed
+ */
+ public function around(ProceedingJoinPoint $proceedingJoinPoint)
+ {
+ $this->test .= ' around-before1 ';
+ $result = $proceedingJoinPoint->proceed();
+ $this->test .= ' around-after1 ';
+ return $result . $this->test;
+ }
+
+ /**
+ * @AfterThrowing()
+ */
+ public function afterThrowing()
+ {
+ echo "aop=1 afterThrowing !\n";
+ }
+}
\ No newline at end of file
From b81859f34b0544245625def962ba4f3bc0c2825a Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Thu, 24 Jan 2019 16:40:58 +0800
Subject: [PATCH 288/643] add aop
---
app/Aspect/LogAspect.php | 19 ++++++++-----------
app/Model/Logic/DemoLogic.php | 8 +++++---
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/app/Aspect/LogAspect.php b/app/Aspect/LogAspect.php
index 511625e2..e87e8f86 100644
--- a/app/Aspect/LogAspect.php
+++ b/app/Aspect/LogAspect.php
@@ -24,17 +24,12 @@
*/
class LogAspect
{
- /**
- * @var
- */
- private $test;
-
/**
* @Before()
*/
public function before()
{
- $this->test .= ' before1 ';
+ echo ' before1 ' . PHP_EOL;
}
/**
@@ -42,7 +37,7 @@ public function before()
*/
public function after()
{
- $this->test .= ' after1 ';
+ echo ' after ' . PHP_EOL;
}
/**
@@ -51,7 +46,9 @@ public function after()
public function afterReturn(JoinPoint $joinPoint)
{
$result = $joinPoint->getReturn();
- return $result . ' afterReturn1 ';
+ echo ' afterReturn ' . PHP_EOL;
+
+ return $result . ' afterReturn1';
}
/**
@@ -62,9 +59,9 @@ public function afterReturn(JoinPoint $joinPoint)
*/
public function around(ProceedingJoinPoint $proceedingJoinPoint)
{
- $this->test .= ' around-before1 ';
- $result = $proceedingJoinPoint->proceed();
- $this->test .= ' around-after1 ';
+ echo ' around-before1 ' . PHP_EOL;
+ $result = $proceedingJoinPoint->proceed();
+ echo ' around-after1 ' . PHP_EOL;
return $result . $this->test;
}
diff --git a/app/Model/Logic/DemoLogic.php b/app/Model/Logic/DemoLogic.php
index e4d8c2a6..595ebb06 100644
--- a/app/Model/Logic/DemoLogic.php
+++ b/app/Model/Logic/DemoLogic.php
@@ -66,9 +66,9 @@ public function __construct(string $name, string $type, DemoData $data)
}
/**
- * @return DemoData
+ * @return string
*/
- public function getData(): DemoData
+ public function getData(): string
{
$this->data->getDao();
echo 'name=' . $this->name . PHP_EOL;
@@ -76,7 +76,9 @@ public function getData(): DemoData
echo 'configName=' . $this->configName . PHP_EOL;
echo 'configHost=' . $this->configHost . PHP_EOL;
- return $this->construnctData;
+ var_dump($this->construnctData);
+
+ return 'do demo logic';
}
/**
From f909c5765947b46824686f81f15142847049b51c Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Thu, 24 Jan 2019 19:24:14 +0800
Subject: [PATCH 289/643] modify aop
---
app/Aspect/LogAspect.php | 20 ++++-----
app/Aspect/LogAspect2.php | 76 +++++++++++++++++++++++++++++++++++
app/Aspect/TestLog.php | 24 +++++++++++
app/Model/Logic/DemoLogic.php | 6 +--
4 files changed, 112 insertions(+), 14 deletions(-)
create mode 100644 app/Aspect/LogAspect2.php
create mode 100644 app/Aspect/TestLog.php
diff --git a/app/Aspect/LogAspect.php b/app/Aspect/LogAspect.php
index e87e8f86..7812d81e 100644
--- a/app/Aspect/LogAspect.php
+++ b/app/Aspect/LogAspect.php
@@ -16,9 +16,9 @@
/**
* Class LogAspect
*
- * @Aspect()
+ * @Aspect(1)
* @PointBean(
- * include={"deloc"}
+ * include={"testLog"}
* )
* @since 2.0
*/
@@ -29,7 +29,7 @@ class LogAspect
*/
public function before()
{
- echo ' before1 ' . PHP_EOL;
+ echo 'apsect1 before' . PHP_EOL;
}
/**
@@ -37,7 +37,7 @@ public function before()
*/
public function after()
{
- echo ' after ' . PHP_EOL;
+ echo 'apsect1 after' . PHP_EOL;
}
/**
@@ -46,9 +46,9 @@ public function after()
public function afterReturn(JoinPoint $joinPoint)
{
$result = $joinPoint->getReturn();
- echo ' afterReturn ' . PHP_EOL;
+ echo 'apsect1 afterReturn ' . PHP_EOL;
- return $result . ' afterReturn1';
+ return 'new value afterReturn ';
}
/**
@@ -59,10 +59,10 @@ public function afterReturn(JoinPoint $joinPoint)
*/
public function around(ProceedingJoinPoint $proceedingJoinPoint)
{
- echo ' around-before1 ' . PHP_EOL;
+ echo 'apsect1 around before ' . PHP_EOL;
$result = $proceedingJoinPoint->proceed();
- echo ' around-after1 ' . PHP_EOL;
- return $result . $this->test;
+ echo 'apsect1 around after ' . PHP_EOL;
+ return $result;
}
/**
@@ -70,6 +70,6 @@ public function around(ProceedingJoinPoint $proceedingJoinPoint)
*/
public function afterThrowing()
{
- echo "aop=1 afterThrowing !\n";
+ echo "apsect1 afterThrowing !\n";
}
}
\ No newline at end of file
diff --git a/app/Aspect/LogAspect2.php b/app/Aspect/LogAspect2.php
new file mode 100644
index 00000000..7877f722
--- /dev/null
+++ b/app/Aspect/LogAspect2.php
@@ -0,0 +1,76 @@
+getReturn();
+ echo 'apsect2 afterReturn ' . PHP_EOL;
+
+ return 'new value afterReturn2 ';
+ }
+
+ /**
+ * @Around()
+ * @param ProceedingJoinPoint $proceedingJoinPoint
+ *
+ * @return mixed
+ */
+ public function around(ProceedingJoinPoint $proceedingJoinPoint)
+ {
+ echo 'apsect2 around before ' . PHP_EOL;
+ $result = $proceedingJoinPoint->proceed();
+ echo 'apsect2 around after ' . PHP_EOL;
+ return $result;
+ }
+
+ /**
+ * @AfterThrowing()
+ */
+ public function afterThrowing()
+ {
+ echo "apsect2 afterThrowing !\n";
+ }
+}
\ No newline at end of file
diff --git a/app/Aspect/TestLog.php b/app/Aspect/TestLog.php
new file mode 100644
index 00000000..4fea6fed
--- /dev/null
+++ b/app/Aspect/TestLog.php
@@ -0,0 +1,24 @@
+data->getDao();
echo 'name=' . $this->name . PHP_EOL;
@@ -76,9 +76,7 @@ public function getData(): string
echo 'configName=' . $this->configName . PHP_EOL;
echo 'configHost=' . $this->configHost . PHP_EOL;
- var_dump($this->construnctData);
-
- return 'do demo logic';
+ return $this->construnctData;
}
/**
From ffb02ff1e8ea56b07bf7aad62d028c4b270a17a2 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Fri, 25 Jan 2019 14:19:17 +0800
Subject: [PATCH 290/643] add
---
app/Aspect/TestLog.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Aspect/TestLog.php b/app/Aspect/TestLog.php
index 4fea6fed..4d42bc8d 100644
--- a/app/Aspect/TestLog.php
+++ b/app/Aspect/TestLog.php
@@ -18,7 +18,7 @@ class TestLog
public function log()
{
- throw new Exception('11');
+// throw new Exception('11');
echo 'test log' . PHP_EOL;
}
}
\ No newline at end of file
From 30b2159b8f413ca241070f27d7c1ecafefd0a73b Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Mon, 28 Jan 2019 18:02:37 +0800
Subject: [PATCH 291/643] add log
---
app/Aspect/TestLog.php | 1 -
bin/test.php | 21 ++++++++++++---------
changelog.md | 4 ++++
3 files changed, 16 insertions(+), 10 deletions(-)
create mode 100644 changelog.md
diff --git a/app/Aspect/TestLog.php b/app/Aspect/TestLog.php
index 4d42bc8d..49e85922 100644
--- a/app/Aspect/TestLog.php
+++ b/app/Aspect/TestLog.php
@@ -3,7 +3,6 @@
namespace App\Aspect;
-use mysql_xdevapi\Exception;
use Swoft\Bean\Annotation\Mapping\Bean;
/**
diff --git a/bin/test.php b/bin/test.php
index ea94a5b3..fb5be992 100644
--- a/bin/test.php
+++ b/bin/test.php
@@ -1,16 +1,19 @@
__proxyCall('Swoft\\Tcp\\Server\\Swoole\\ConnectListener', 'onConnect', func_get_args());
- }
+
}
diff --git a/changelog.md b/changelog.md
new file mode 100644
index 00000000..91829aca
--- /dev/null
+++ b/changelog.md
@@ -0,0 +1,4 @@
+# change log
+
+1. 新增对象池
+2. prototype优化,clone
\ No newline at end of file
From 7e3006159c3c016b0a8f0046b2e965201a939165 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Thu, 31 Jan 2019 00:08:46 +0800
Subject: [PATCH 292/643] add controller
---
app/Controller/TestController.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php
index 52799e51..e29a8c69 100644
--- a/app/Controller/TestController.php
+++ b/app/Controller/TestController.php
@@ -12,5 +12,8 @@
*/
class TestController
{
-
+ public function test()
+ {
+ return 'swoft framework';
+ }
}
\ No newline at end of file
From fda609adf07ed2351540075a01d8ddb264af8c71 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Sat, 2 Feb 2019 21:54:37 +0800
Subject: [PATCH 293/643] add composer
---
composer.json | 2 ++
1 file changed, 2 insertions(+)
diff --git a/composer.json b/composer.json
index bd67a946..0a23b873 100644
--- a/composer.json
+++ b/composer.json
@@ -23,6 +23,8 @@
"swoft/http-server": "^2.0",
"swoft/websocket-server": "^2.0",
"swoft/log": "^2.0",
+ "swoft/db": "^2.0",
+ "swoft/connection-pool": "^2.0",
"swoft/component": "2.0.x-dev as 2.0"
},
"require-dev": {
From 0595668e853cf5ae55000d182cdbd60a0ef2b4d0 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Mon, 18 Feb 2019 22:13:33 +0800
Subject: [PATCH 294/643] modify composer
---
bin/test.php | 19 -------------------
composer.json | 2 ++
2 files changed, 2 insertions(+), 19 deletions(-)
delete mode 100644 bin/test.php
diff --git a/bin/test.php b/bin/test.php
deleted file mode 100644
index fb5be992..00000000
--- a/bin/test.php
+++ /dev/null
@@ -1,19 +0,0 @@
-=7.1",
+ "ext-pdo": "*",
+ "ext-json": "*",
"swoft/annotation": "^2.0",
"swoft/bean": "^2.0",
"swoft/event": "^2.0",
From 3bc5da9ecfb7e8c1e123747e131733ea33938cb0 Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Sat, 23 Feb 2019 15:10:36 +0800
Subject: [PATCH 295/643] add console
---
composer.json | 2 ++
1 file changed, 2 insertions(+)
diff --git a/composer.json b/composer.json
index 638427a1..df338583 100644
--- a/composer.json
+++ b/composer.json
@@ -27,6 +27,8 @@
"swoft/log": "^2.0",
"swoft/db": "^2.0",
"swoft/connection-pool": "^2.0",
+ "swoft/test": "^2.0",
+ "swoft/console": "^2.0",
"swoft/component": "2.0.x-dev as 2.0"
},
"require-dev": {
From b80430d3cc5131052b37b356977e839186bf39fa Mon Sep 17 00:00:00 2001
From: stelin <794774870@qq.com>
Date: Tue, 26 Feb 2019 17:16:12 +0800
Subject: [PATCH 296/643] add
---
app/Controller/TestController.php | 2 +-
app/Model/Logic/DemoLogic.php | 4 +-
bin/bootstrap.php | 14 +-
bin/phpunit | 69122 ++++++++++++++++++++++++++++
composer.json | 4 +-
5 files changed, 69128 insertions(+), 18 deletions(-)
create mode 100755 bin/phpunit
diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php
index e29a8c69..aad9f122 100644
--- a/app/Controller/TestController.php
+++ b/app/Controller/TestController.php
@@ -14,6 +14,6 @@ class TestController
{
public function test()
{
- return 'swoft framework';
+ return 'swoft framework hello';
}
}
\ No newline at end of file
diff --git a/app/Model/Logic/DemoLogic.php b/app/Model/Logic/DemoLogic.php
index 061debdc..9435a4d5 100644
--- a/app/Model/Logic/DemoLogic.php
+++ b/app/Model/Logic/DemoLogic.php
@@ -5,7 +5,7 @@
use App\Model\Data\DemoData;
use Swoft\Bean\Annotation\Mapping\Bean;
use Swoft\Bean\Annotation\Mapping\Inject;
-use Swoft\Config\Annotation\Config;
+use Swoft\Config\Annotation\Mapping\Config;
/**
* @Bean(alias="deloc")
@@ -57,7 +57,7 @@ class DemoLogic
* @param string $type
* @param DemoData
*/
- public function __construct(string $name, string $type, DemoData $data)
+ public function __construct(string $name = '', string $type = '', DemoData $data = null)
{
$this->name = $name;
$this->type = $type;
diff --git a/bin/bootstrap.php b/bin/bootstrap.php
index fd237ed0..b1d05993 100644
--- a/bin/bootstrap.php
+++ b/bin/bootstrap.php
@@ -1,15 +1,3 @@
')) {
+ fwrite(
+ STDERR,
+ sprintf(
+ 'PHPUnit 7.5.6 by Sebastian Bergmann and contributors.' . PHP_EOL . PHP_EOL .
+ 'This version of PHPUnit is supported on PHP 7.1 and PHP 7.2.' . PHP_EOL .
+ 'You are using PHP %s (%s).' . PHP_EOL,
+ PHP_VERSION,
+ PHP_BINARY
+ )
+ );
+
+ die(1);
+}
+
+if (__FILE__ === realpath($_SERVER['SCRIPT_NAME'])) {
+ $execute = true;
+} else {
+ $execute = false;
+}
+
+$options = getopt('', array('prepend:', 'manifest'));
+
+if (isset($options['prepend'])) {
+ require $options['prepend'];
+}
+
+if (isset($options['manifest'])) {
+ $printManifest = true;
+}
+
+unset($options);
+
+define('__PHPUNIT_PHAR__', str_replace(DIRECTORY_SEPARATOR, '/', __FILE__));
+define('__PHPUNIT_PHAR_ROOT__', 'phar://phpunit-7.5.6.phar');
+
+Phar::mapPhar('phpunit-7.5.6.phar');
+
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/DeepCopy.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Exception/CloneException.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Exception/PropertyException.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Filter/Filter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Filter/KeepFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Filter/ReplaceFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Filter/SetNullFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Matcher/Matcher.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Matcher/PropertyMatcher.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Matcher/PropertyNameMatcher.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Matcher/PropertyTypeMatcher.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/Reflection/ReflectionHelper.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/TypeFilter/TypeFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/TypeFilter/Date/DateIntervalFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/TypeFilter/ReplaceFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/TypeFilter/ShallowCopyFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php';
+require 'phar://phpunit-7.5.6.phar' . '/myclabs-deep-copy/DeepCopy/TypeMatcher/TypeMatcher.php';
+require 'phar://phpunit-7.5.6.phar' . '/doctrine-instantiator/Doctrine/Instantiator/Exception/ExceptionInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/doctrine-instantiator/Doctrine/Instantiator/Exception/InvalidArgumentException.php';
+require 'phar://phpunit-7.5.6.phar' . '/doctrine-instantiator/Doctrine/Instantiator/Exception/UnexpectedValueException.php';
+require 'phar://phpunit-7.5.6.phar' . '/doctrine-instantiator/Doctrine/Instantiator/InstantiatorInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/doctrine-instantiator/Doctrine/Instantiator/Instantiator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Assert.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/SelfDescribing.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/AssertionFailedError.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/CodeCoverageException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/Constraint.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/ArrayHasKey.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/ArraySubset.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/Composite.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/Attribute.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/Callback.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/ClassHasAttribute.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/ClassHasStaticAttribute.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/Count.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/DirectoryExists.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/ExceptionCode.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/ExceptionMessage.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/ExceptionMessageRegularExpression.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/FileExists.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/GreaterThan.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsAnything.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsEmpty.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsEqual.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsFalse.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsFinite.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsIdentical.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsInfinite.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsInstanceOf.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsJson.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsNan.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsNull.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsReadable.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsTrue.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsType.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/IsWritable.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/JsonMatches.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/JsonMatchesErrorMessageProvider.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/LessThan.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/LogicalAnd.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/LogicalNot.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/LogicalOr.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/LogicalXor.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/ObjectHasAttribute.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/RegularExpression.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/SameSize.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/StringContains.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/StringEndsWith.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/StringMatchesFormatDescription.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/StringStartsWith.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/TraversableContains.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Constraint/TraversableContainsOnly.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/RiskyTest.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/RiskyTestError.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/CoveredCodeNotExecutedException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Test.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/TestSuite.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/DataProviderTestSuite.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Error/Error.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Error/Deprecated.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Error/Notice.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Error/Warning.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/ExceptionWrapper.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/ExpectationFailedException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/IncompleteTest.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/TestCase.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/IncompleteTestCase.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/IncompleteTestError.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/InvalidCoversTargetException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MissingCoversAnnotationException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Exception/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Exception/BadMethodCallException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Builder/Identity.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Builder/Stub.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Builder/Match.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Builder/ParametersMatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Builder/MethodNameMatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Builder/InvocationMocker.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Builder/NamespaceMatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Generator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Invocation/Invocation.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub/MatcherCollection.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Verifiable.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Invokable.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/InvocationMocker.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Invocation/StaticInvocation.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Invocation/ObjectInvocation.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/Invocation.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/InvokedRecorder.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/AnyInvokedCount.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/StatelessInvocation.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/AnyParameters.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/ConsecutiveParameters.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/DeferredError.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/InvokedAtIndex.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/InvokedAtLeastCount.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/InvokedAtLeastOnce.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/InvokedAtMostCount.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/InvokedCount.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/MethodName.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Matcher/Parameters.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/MockBuilder.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/MockMethod.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/MockMethodSet.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/MockObject.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/ForwardCompatibility/MockObject.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Exception/RuntimeException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub/ConsecutiveCalls.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub/ReturnArgument.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub/ReturnCallback.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub/ReturnReference.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub/ReturnSelf.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub/ReturnStub.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/MockObject/Stub/ReturnValueMap.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/OutputError.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/SkippedTest.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/SkippedTestCase.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/SkippedTestError.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/SkippedTestSuiteError.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/SyntheticError.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/TestFailure.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/TestListener.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/TestListenerDefaultImplementation.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/TestResult.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/TestSuiteIterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/UnintentionallyCoveredCodeError.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/Warning.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Framework/WarningTestCase.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/Hook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/TestHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/AfterIncompleteTestHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/AfterLastTestHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/AfterRiskyTestHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/AfterSkippedTestHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/AfterSuccessfulTestHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/AfterTestErrorHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/AfterTestFailureHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/AfterTestHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/AfterTestWarningHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/BaseTestRunner.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/BeforeFirstTestHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/BeforeTestHook.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Filter/GroupFilterIterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Filter/ExcludeGroupFilterIterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Filter/Factory.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Filter/IncludeGroupFilterIterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Filter/NameFilterIterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TestResultCacheInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/NullTestResultCache.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/PhptTestCase.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/ResultCacheExtension.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/TestSuiteLoader.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/StandardTestSuiteLoader.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Hook/TestListenerAdapter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TestResultCache.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/TestSuiteSorter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Runner/Version.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/TextUI/Command.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Printer.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/TextUI/ResultPrinter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/TextUI/TestRunner.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Blacklist.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Configuration.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/ConfigurationGenerator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/ErrorHandler.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/FileLoader.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Filesystem.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Filter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Getopt.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/GlobalState.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/InvalidArgumentHelper.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Json.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Log/JUnit.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Log/TeamCity.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/PHP/AbstractPhpProcess.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/PHP/DefaultPhpProcess.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/PHP/WindowsPhpProcess.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/RegularExpression.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Test.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TestDox/CliTestDoxPrinter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TestDox/ResultPrinter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TestDox/HtmlResultPrinter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TestDox/NamePrettifier.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TestDox/TestResult.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TestDox/TextResultPrinter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TestDox/XmlResultPrinter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/TextTestListRenderer.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Type.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/XdebugFilterScriptGenerator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/Xml.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpunit/Util/XmlTestListRenderer.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-token-stream/Token.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-token-stream/Token/Stream.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-token-stream/Token/Stream/CachingFactory.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/Type.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/Application.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/ApplicationName.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/Author.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/AuthorCollection.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/AuthorCollectionIterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ManifestElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/AuthorElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ElementCollection.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/AuthorElementCollection.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/BundledComponent.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/BundledComponentCollection.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/BundledComponentCollectionIterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/BundlesElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ComponentElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ComponentElementCollection.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ContainsElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/CopyrightElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/CopyrightInformation.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/Email.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/exceptions/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ExtElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ExtElementCollection.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/Extension.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ExtensionElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/exceptions/InvalidApplicationNameException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/exceptions/InvalidEmailException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/exceptions/InvalidUrlException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/Library.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/License.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/LicenseElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/Manifest.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ManifestDocument.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/exceptions/ManifestDocumentException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/ManifestDocumentLoadingException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/ManifestDocumentMapper.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/exceptions/ManifestDocumentMapperException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/exceptions/ManifestElementException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/ManifestLoader.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/exceptions/ManifestLoaderException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/ManifestSerializer.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/PhpElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/Requirement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/PhpExtensionRequirement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/PhpVersionRequirement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/RequirementCollection.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/RequirementCollectionIterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/xml/RequiresElement.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-manifest/values/Url.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/constraints/VersionConstraint.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/constraints/AbstractVersionConstraint.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/constraints/AndVersionConstraintGroup.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/constraints/AnyVersionConstraint.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/constraints/ExactVersionConstraint.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/exceptions/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/constraints/GreaterThanOrEqualToVersionConstraint.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/exceptions/InvalidPreReleaseSuffixException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/exceptions/InvalidVersionException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/constraints/OrVersionConstraintGroup.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/PreReleaseSuffix.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/constraints/SpecificMajorAndMinorVersionConstraint.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/constraints/SpecificMajorVersionConstraint.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/exceptions/UnsupportedVersionConstraintException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/Version.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/VersionConstraintParser.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/VersionConstraintValue.php';
+require 'phar://phpunit-7.5.6.phar' . '/phar-io-version/VersionNumber.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/ArgumentsWildcard.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/TokenInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/AnyValueToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/AnyValuesToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/ApproximateValueToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/ArrayCountToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/ArrayEntryToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/ArrayEveryEntryToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/CallbackToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/ExactValueToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/IdenticalValueToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/LogicalAndToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/LogicalNotToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/ObjectStateToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/StringContainsToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Argument/Token/TypeToken.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Call/Call.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Call/CallCenter.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/Comparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Comparator/ClosureComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/Factory.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Comparator/Factory.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/ArrayComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/ObjectComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Comparator/ProphecyComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/Doubler.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/CachedDoubler.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/ClassPatchInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/HhvmExceptionPatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/KeywordPatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/MagicCallPatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/ThrowablePatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/ClassPatch/TraversablePatch.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/DoubleInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/Generator/ClassCodeGenerator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/Generator/ClassCreator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/Generator/ClassMirror.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/Generator/Node/ArgumentNode.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/Generator/Node/ClassNode.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/Generator/Node/MethodNode.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/Generator/ReflectionInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/Generator/TypeHintReference.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/LazyDouble.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Doubler/NameGenerator.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Prophecy/ProphecyException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Prophecy/ObjectProphecyException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Call/UnexpectedCallException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Doubler/DoublerException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Doubler/ClassCreatorException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Doubler/ClassMirrorException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Doubler/DoubleException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Doubler/ClassNotFoundException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Doubler/InterfaceNotFoundException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Doubler/MethodNotExtendableException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Doubler/MethodNotFoundException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Doubler/ReturnByReferenceException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/InvalidArgumentException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Prediction/PredictionException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Prediction/AggregateException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Prediction/FailedPredictionException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Prophecy/MethodProphecyException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Prediction/NoCallsException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Prediction/UnexpectedCallsException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/PhpDocumentor/ClassTagRetriever.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prediction/PredictionInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prediction/CallPrediction.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prediction/CallTimesPrediction.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prediction/CallbackPrediction.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prediction/NoCallsPrediction.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Promise/PromiseInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Promise/CallbackPromise.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Promise/ReturnArgumentPromise.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Promise/ReturnPromise.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Promise/ThrowPromise.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prophecy/MethodProphecy.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prophecy/ProphecyInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prophecy/ObjectProphecy.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prophecy/ProphecySubjectInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prophecy/RevealerInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prophecy/Revealer.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Prophet.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Util/ExportUtil.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpspec-prophecy/Prophecy/Util/StringUtil.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/CodeCoverage.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Exception/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Exception/RuntimeException.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Exception/CoveredCodeNotExecutedException.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Driver/Driver.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Driver/PHPDBG.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Driver/Xdebug.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Filter.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Exception/InvalidArgumentException.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Exception/MissingCoversAnnotationException.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Node/AbstractNode.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Node/Builder.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Node/Directory.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Node/File.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Node/Iterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Clover.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Crap4j.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Html/Renderer.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Html/Renderer/Dashboard.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Html/Renderer/Directory.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Html/Facade.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Html/Renderer/File.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/PHP.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Text.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/BuildInformation.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Coverage.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Node.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Directory.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Facade.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/File.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Method.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Project.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Report.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Source.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Tests.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Totals.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Report/Xml/Unit.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Exception/UnintentionallyCoveredCodeException.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Util.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-code-coverage/Version.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-code-unit-reverse-lookup/Wizard.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/ComparisonFailure.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/DOMNodeComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/DateTimeComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/ScalarComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/NumericComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/DoubleComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/ExceptionComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/MockObjectComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/ResourceComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/SplObjectStorageComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-comparator/TypeComparator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Chunk.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Exception/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Exception/InvalidArgumentException.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Exception/ConfigurationException.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Diff.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Differ.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Line.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/LongestCommonSubsequenceCalculator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/MemoryEfficientLongestCommonSubsequenceCalculator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Output/DiffOutputBuilderInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Output/AbstractChunkOutputBuilder.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Output/DiffOnlyOutputBuilder.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Output/StrictUnifiedDiffOutputBuilder.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Output/UnifiedDiffOutputBuilder.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/Parser.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-diff/TimeEfficientLongestCommonSubsequenceCalculator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-environment/Console.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-environment/OperatingSystem.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-environment/Runtime.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-exporter/Exporter.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-file-iterator/Facade.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-file-iterator/Factory.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-file-iterator/Iterator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-global-state/Blacklist.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-global-state/CodeExporter.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-global-state/exceptions/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-global-state/Restorer.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-global-state/exceptions/RuntimeException.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-global-state/Snapshot.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-invoker/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-invoker/Invoker.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-invoker/TimeoutException.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-object-enumerator/Enumerator.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-object-enumerator/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-object-enumerator/InvalidArgumentException.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-object-reflector/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-object-reflector/InvalidArgumentException.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-object-reflector/ObjectReflector.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-recursion-context/Context.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-recursion-context/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-recursion-context/InvalidArgumentException.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-resource-operations/ResourceOperations.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-timer/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-timer/RuntimeException.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-timer/Timer.php';
+require 'phar://phpunit-7.5.6.phar' . '/sebastian-version/Version.php';
+require 'phar://phpunit-7.5.6.phar' . '/php-text-template/Template.php';
+require 'phar://phpunit-7.5.6.phar' . '/theseer-tokenizer/Exception.php';
+require 'phar://phpunit-7.5.6.phar' . '/theseer-tokenizer/NamespaceUri.php';
+require 'phar://phpunit-7.5.6.phar' . '/theseer-tokenizer/NamespaceUriException.php';
+require 'phar://phpunit-7.5.6.phar' . '/theseer-tokenizer/Token.php';
+require 'phar://phpunit-7.5.6.phar' . '/theseer-tokenizer/TokenCollection.php';
+require 'phar://phpunit-7.5.6.phar' . '/theseer-tokenizer/TokenCollectionException.php';
+require 'phar://phpunit-7.5.6.phar' . '/theseer-tokenizer/Tokenizer.php';
+require 'phar://phpunit-7.5.6.phar' . '/theseer-tokenizer/XMLSerializer.php';
+require 'phar://phpunit-7.5.6.phar' . '/webmozart-assert/Assert.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlockFactoryInterface.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlockFactory.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Description.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/DescriptionFactory.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/ExampleFinder.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Serializer.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/TagFactory.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/StandardTagFactory.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tag.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Factory/StaticMethod.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/BaseTag.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Author.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Covers.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Deprecated.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Example.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Factory/Strategy.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/AlignFormatter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/PassthroughFormatter.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Generic.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Link.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Method.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Param.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Property.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyRead.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyWrite.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Reference.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Fqsen.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Url.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Return_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/See.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Since.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Source.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Throws.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Uses.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Var_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-docblock/DocBlock/Tags/Version.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-common/Element.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-common/File.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-common/Fqsen.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/FqsenResolver.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-common/Location.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-common/Project.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-reflection-common/ProjectFactory.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Type.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/TypeResolver.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Array_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Boolean.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Callable_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Compound.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Context.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/ContextFactory.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Float_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Integer.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Iterable_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Mixed_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Null_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Nullable.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Object_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Parent_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Resource_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Scalar.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Self_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Static_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/String_.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/This.php';
+require 'phar://phpunit-7.5.6.phar' . '/phpdocumentor-type-resolver/Types/Void_.php';
+
+if ($execute) {
+ if (isset($printManifest)) {
+ print file_get_contents(__PHPUNIT_PHAR_ROOT__ . '/manifest.txt');
+
+ exit;
+ }
+
+ unset($execute);
+
+ PHPUnit\TextUI\Command::main();
+}
+
+__HALT_COMPILER(); ?>
+|� v phpunit-7.5.6.phar - phpdocumentor-type-resolver/FqsenResolver.php �yj\ �R�ٶ $ phpdocumentor-type-resolver/Type.php� �yj\� ��[L� / phpdocumentor-type-resolver/Types/Resource_.php� �yj\� Nf
�� - phpdocumentor-type-resolver/Types/Context.phpV �yj\V �{�� , phpdocumentor-type-resolver/Types/Scalar.php �yj\ U���� - phpdocumentor-type-resolver/Types/Boolean.php� �yj\� �f�� - phpdocumentor-type-resolver/Types/String_.php� �yj\� ��� - phpdocumentor-type-resolver/Types/Parent_.php4 �yj\4 ��j� + phpdocumentor-type-resolver/Types/Self_.php �yj\ ��9'� . phpdocumentor-type-resolver/Types/Nullable.php� �yj\� �Ab�� . phpdocumentor-type-resolver/Types/Compound.php �yj\ ���|� / phpdocumentor-type-resolver/Types/Iterable_.php� �yj\� O��Ӷ + phpdocumentor-type-resolver/Types/Void_.phpW �yj\W ��ֶ / phpdocumentor-type-resolver/Types/Callable_.php� �yj\� 4ɿ� , phpdocumentor-type-resolver/Types/Mixed_.php� �yj\� ϯ�ʶ - phpdocumentor-type-resolver/Types/Object_.php� �yj\� ��Q�� , phpdocumentor-type-resolver/Types/Float_.php� �yj\� �w,� - phpdocumentor-type-resolver/Types/Integer.php� �yj\� "s�� * phpdocumentor-type-resolver/Types/This.php� �yj\� �h²� , phpdocumentor-type-resolver/Types/Array_.php- �yj\- ��_� - phpdocumentor-type-resolver/Types/Static_.phpU �yj\U �ޟ� 4 phpdocumentor-type-resolver/Types/ContextFactory.php� �yj\� E�3� + phpdocumentor-type-resolver/Types/Null_.php� �yj\� @�%�� , phpdocumentor-type-resolver/TypeResolver.phpw$ �yj\w$ U��y� # phpdocumentor-type-resolver/LICENSE8 �yj\8 ��ʶ object-reflector/LICENSE
+ �yj\
+ �F��� H phpspec-prophecy/Prophecy/Exception/Prophecy/ObjectProphecyException.php �yj\ �:�F� B phpspec-prophecy/Prophecy/Exception/Prophecy/ProphecyException.php� �yj\� ��$϶ H phpspec-prophecy/Prophecy/Exception/Prophecy/MethodProphecyException.php) �yj\) F��4� F phpspec-prophecy/Prophecy/Exception/Doubler/ClassNotFoundException.php� �yj\� h+ E phpspec-prophecy/Prophecy/Exception/Doubler/ClassCreatorException.php� �yj\� 77/%� J phpspec-prophecy/Prophecy/Exception/Doubler/InterfaceNotFoundException.php� �yj\� ����� J phpspec-prophecy/Prophecy/Exception/Doubler/ReturnByReferenceException.php� �yj\� ��� ? phpspec-prophecy/Prophecy/Exception/Doubler/DoubleException.php� �yj\� z�F�� D phpspec-prophecy/Prophecy/Exception/Doubler/ClassMirrorException.php� �yj\� ۉ?� G phpspec-prophecy/Prophecy/Exception/Doubler/MethodNotFoundException.php� �yj\� �X� @ phpspec-prophecy/Prophecy/Exception/Doubler/DoublerException.php� �yj\� �Z^� L phpspec-prophecy/Prophecy/Exception/Doubler/MethodNotExtendableException.phpD �yj\D �p�� 1 phpspec-prophecy/Prophecy/Exception/Exception.php+ �yj\+ ���� @ phpspec-prophecy/Prophecy/Exception/InvalidArgumentException.php� �yj\� �g�� E phpspec-prophecy/Prophecy/Exception/Prediction/AggregateException.php �yj\ ;�� P phpspec-prophecy/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php �yj\ � ƶ F phpspec-prophecy/Prophecy/Exception/Prediction/PredictionException.php� �yj\� 2T�Ѷ K phpspec-prophecy/Prophecy/Exception/Prediction/UnexpectedCallsException.php, �yj\, ���a� C phpspec-prophecy/Prophecy/Exception/Prediction/NoCallsException.php� �yj\� �l<�� L phpspec-prophecy/Prophecy/Exception/Prediction/FailedPredictionException.phpJ �yj\J ~��D� D phpspec-prophecy/Prophecy/Exception/Call/UnexpectedCallException.php� �yj\� ��� 5 phpspec-prophecy/Prophecy/Prophecy/ObjectProphecy.php� �yj\� �5D� 5 phpspec-prophecy/Prophecy/Prophecy/MethodProphecy.phpq1 �yj\q1 �?� 8 phpspec-prophecy/Prophecy/Prophecy/RevealerInterface.phpH �yj\H �gZ�� 8 phpspec-prophecy/Prophecy/Prophecy/ProphecyInterface.php, �yj\, �W� / phpspec-prophecy/Prophecy/Prophecy/Revealer.php� �yj\� j�ɸ� ? phpspec-prophecy/Prophecy/Prophecy/ProphecySubjectInterface.php� �yj\� i�� 8 phpspec-prophecy/Prophecy/Argument/ArgumentsWildcard.php4 �yj\4 A;K2� : phpspec-prophecy/Prophecy/Argument/Token/CallbackToken.php, �yj\, cR�̶ <