斯沃夫特是什么? (What is Swoft?)
Swoft is a PHP high performance microservice coroutine framework. It has been published for many years and has become the best choice for php. It can be like Go, built-in coroutine web server and common coroutine client and is resident in memory, independent of traditional PHP-FPM. There are similar Go language operations, similar to the Spring Cloud framework flexible annotations.
Swoft是一个PHP高性能微服务协程框架。 它已经发布了很多年,并已成为php的最佳选择。 它可以像Go,内置的协程Web服务器和通用协程客户端一样,驻留在内存中,独立于传统PHP-FPM。 有类似的Go语言操作,类似于Spring Cloud框架的灵活注释。
Through three years of accumulation and direction exploration, Swoft has made Swoft the Spring Cloud in the PHP world, which is the best choice for PHP's high-performance framework and microservices management.
通过三年的积累和方向探索,Swoft使Swoft成为了PHP世界中的Spring Cloud,它是PHP高性能框架和微服务管理的最佳选择。
Github (Github)
https://github.com/swoft-cloud/swoft
https://github.com/swoft-cloud/swoft
Swoft v2.0.7 (Swoft v2.0.7)
Swoft v2.0.7
continues to sail on v2.0.6
and has been used in a large number of production operations, which has been recognized and supported by many users. The official version has made a lot of improvements and optimizations, with better performance.
Swoft v2.0.7
继续驶向v2.0.6
并在大量生产操作,这得到了众多用户的认可和支持已被使用。 正式版进行了许多改进和优化,具有更好的性能。
- Added Http Session function component, provides http session management, supports multiple storage drivers 添加了Http Session功能组件,提供http会话管理,支持多个存储驱动程序
- Enhanced TCP server request support to add global or corresponding method middleware 增强的TCP服务器请求支持添加全局或相应方法中间件
- Enhanced Websocket server message request support for adding global or corresponding method middleware 增强的Websocket服务器消息请求支持,用于添加全局或相应的方法中间件
Http会话 (Http Session)
Install the swoft/session component with Composer
使用Composer安装swoft / session组件
Execute
composer require swoft/session
in the directory where the project composer.json is located.执行
composer require swoft/session
项目composer.json所在目录中的composer require swoft/session
。Add
Swoft\Http\Session\SessionMiddleware
middleware to the global middleware将
Swoft\Http\Session\SessionMiddleware
中间件添加到全局中间件
In app/bean.php
:
在app/bean.php
:
'httpDispatcher' => [
// Add global http middleware
'middlewares' => [
\Swoft\Http\Session\SessionMiddleware::class,
],
],
runtime/sessions
directoryruntime/sessions
目录中
More on the driver only need to configure the corresponding handler
. For example, configure the Redis
driver:
关于驱动程序的更多信息只需要配置相应的handler
。 例如,配置Redis
驱动程序:
'sessionHandler' => [
'class' => RedisHandler::class,
// Config redis pool
'redis' => bean('redis.pool')
],
Websocket消息传递中间件 (Websocket Messaging Middleware)
- Global middleware 全球中间件
Configured in app/bean.php
:
在app/bean.php
配置:
/** @see \Swoft\WebSocket\Server\WsMessageDispatcher */
'wsMsgDispatcher' => [
'middlewares' => [
\App\WebSocket\Middleware\GlobalWsMiddleware::class
],
],
- Acting on the controller 代理控制器
/**
* Class HomeController
*
* @WsController(middlewares={DemoMiddleware::class})
*/
class TestController
{}
TCP请求中间件 (TCP Request Middleware)
- Global middleware 全球中间件
Configured in app/bean.php
:
在app/bean.php
配置:
/** @see \Swoft\Tcp\Server\TcpDispatcher */
'tcpDispatcher' => [
'middlewares' => [
\App\Tcp\Middleware\GlobalTcpMiddleware::class
],
],
- Acting on the controller 代理控制器
/**
* Class DemoController
*
* @TcpController(middlewares={DemoMiddleware::class})
*/
class DemoController
{
// ....
}
更新记录 (Update Log)
Swoole\WebSocket\Server::push
The fourth parameter$finish
was changed to int type after swoole4.4.12
.
Swoole\WebSocket\Server::push
在第4.4.12
之后,第四个参数$finish
更改为int类型。The
TcpServerEvent::CONNECT
event parameter of the tcp server remains the same as receive and close.$fd, $server
swap positions.tcp服务器的
TcpServerEvent::CONNECT
事件参数与receive和close保持相同。$fd, $server
交换头寸。
Github (Github)
https://github.com/swoft-cloud/swoft
https://github.com/swoft-cloud/swoft
Fixed:
固定的 :
When fixing config injection, if the value is not found, the default value of the corresponding type will be used to override the attribute, causing the default value of the attribute to be overwritten d84d50a7
修复配置注入时,如果找不到该值,则将使用相应类型的默认值覆盖该属性,从而导致该属性的默认值被覆盖d84d50a7
Fixed when using the message schedule in ws server, no empty data was filtered, resulting in one more response. Avoid method swoft-cloud/swoft#1002 [d84d50a7](https://github.com/swoft-cloud/swoft-component/ Pull/522/commits/d84d50a76c4c7ff19dc0896868745cfe8f0d93c9)
已修复在ws服务器中使用消息计划时,未过滤任何空数据,从而导致另一个响应的问题。 避免方法swoft-cloud / swoft#1002 [d84d50a7]( https://github.com/swoft-cloud/swoft-component/ Pull / 522 / commits / d84d50a76c4c7ff19dc0896868745cfe8f0d93c9)
Fixed when using message scheduling in tcp server, no empty data was filtered, resulting in one more response. 07a01ba1
已修复在tcp服务器中使用消息调度时,未过滤任何空数据,从而导致另一个响应的问题。 07a01ba1
Fixed missing swoft/stdlib library dependencies when using console component independently c569c81a
Fixed
ArrayHelper::get
When the input key is integer, the parameter parameter is incorrect a44dcad修复
ArrayHelper::get
当输入键为整数时,参数parameter不正确a44dcadFix console rendering using table, when calculating int value, calculate width report type error 74a835ab
使用表格修复控制台渲染,计算int值时,计算宽度报告类型错误74a835ab
Fixed error in the component user can not customize the default error handling level 4c78aeb
修复了组件用户中无法自定义默认错误处理级别4c78aeb的错误
Fix Enable and disable Component settings
isEnable()
does not work da8c51e56修复启用和禁用组件设置
isEnable()
不起作用da8c51e56Fixes Using the
uniqid()
method in the cygwin environment must set the second parameter to true c7f688f修复在cygwin环境中使用
uniqid()
方法必须将第二个参数设置为true c7f688fFixed Unable to set process title in cygwin environment and cause error c466f6a
修复了无法在cygwin环境中设置进程标题并导致错误c466f6a
Fixed Unable to delete browser cookie data using http
response->delCookie()
8eb9241Fixed ws server message dispatching, the received ext data is not necessarily an array causing an error ff45b35
修复了ws服务器消息调度,接收到的ext数据不一定是引起错误的数组ff45b35
Fix log file split by time c195413
修复按时间分割的日志文件c195413
Fix the log
JSON
format small problem a3fc6b9修复日志
JSON
格式的小问题a3fc6b9Fixed
rpc
service providergetList
call twice fd03e71固定
rpc
服务提供商getList
两次调用fd03e71Fix
redis cluster
does not supportauth
parameter 7a678f修复
redis cluster
不支持auth
参数7a678fFix model query
json
type, does not supportarray
6023a9修复模型查询
json
类型,不支持array
6023a9Fixed redis
multi
operation not connected in time e5f698固定的Redis
multi
操作未及时连接E5F698Fix redis does not support
expireAt
,geoRadius
749241修复redis不支持
expireAt
,geoRadius
749241Fixed
crontab
timestamp detection deviation problem eb08a46固定
crontab
时间戳检测偏差问题eb08a46
Update(Update):
更新(Update) :
Update console also emits an event before rendering the help message
ConsoleEvent::SHOW_HELP_BEFORE
d3f7bc3在呈现帮助消息
ConsoleEvent::SHOW_HELP_BEFORE
d3f7bc3之前,更新控制台还会发出一个事件。Simplify and unify http, ws, tcp, rpc server management command logic f202c826
简化和统一http,ws,tcp,rpc服务器管理命令逻辑f202c826
Update the ws and tcp Connection classes to add the
newFromArray
andtoArray
methods to facilitate exporting information and restoring connections via third-party storage (redis
) [a8b0b7c](https://github.com/swoft-cloud/swoft -component/pull/528/commits/a8b0b7c77d56d4392eba75d13a911816b9dc0cee)更新ws和tcp Connection类以添加
newFromArray
和toArray
方法,以利于通过第三方存储(redis
)导出信息和恢复连接[a8b0b7c]( https://github.com/swoft-cloud/swoft -component / pull / 528 / commits / a8b0b7c77d56d4392eba75d13a911816b9dc0cee)Optimize server to add a unified swoole pipe message event handler, use the swowt event in ws, tcp to handle interprocess messages 1c51a8c
优化服务器以添加统一的Swoole管道消息事件处理程序,在ws,tcp中使用swowt事件处理进程间消息1c51a8c
Enhancement:
增强功能 :
Now tcp requests support adding global or corresponding method middleware, and the process and usage are similar to http middleware. Useful only when using system scheduling 6b593877
现在,tcp请求支持添加全局或相应的方法中间件,其过程和用法类似于http中间件。 仅在使用系统调度 6b593877 时有用
Now the websocket message request supports adding global or corresponding method middleware, and the process and usage are similar to http middleware. Useful only when using system scheduling 9739815
现在,websocket消息请求支持添加全局或相应的方法中间件,并且过程和用法类似于http中间件。 仅在使用系统计划 9739815 时有用
Event Management allows setting
destroyAfterFire
to clean up the data carried in the event after each event dispatch 50bf43d3事件管理允许在每次事件分派50bf43d3之后设置
destroyAfterFire
来清除事件中携带的数据Database error exception added
code
returns fd306f4添加数据库错误异常的
code
返回fd306f4Coroutine file operation
writeFile
New write failure exception 08c4244协程文件操作
writeFile
新的写入失败异常08c4244RPC new parameter verification 8646fc5
RPC新参数验证8646FC5
Github (Github)
https://github.com/swoft-cloud/swoft
https://github.com/swoft-cloud/swoft