PHP微服务框架:Swoft v2.0.7按计划发布

斯沃夫特是什么? (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 directory runtime/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 swoole 4.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

    修复了独立使用控制台组件C569C81A时缺少的swoft / stdlib库依赖

  • Fixed ArrayHelper::get When the input key is integer, the parameter parameter is incorrect a44dcad

    修复ArrayHelper::get当输入键为整数时,参数parameter不正确a44dcad

  • Fix 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()不起作用da8c51e56

  • Fixes Using the uniqid() method in the cygwin environment must set the second parameter to true c7f688f

    修复在cygwin环境中使用uniqid()方法必须将第二个参数设置为true c7f688f

  • Fixed 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() 8eb9241

    修复了无法使用http response->delCookie() 8eb9241删除浏览器cookie数据的问题

  • Fixed 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格式的小问题a3fc6b9

  • Fixed rpc service provider getList call twice fd03e71

    固定rpc服务提供商getList两次调用fd03e71

  • Fix redis cluster does not support auth parameter 7a678f

    修复redis cluster不支持auth参数7a678f

  • Fix model query json type, does not support array 6023a9

    修复模型查询json类型,不支持array 6023a9

  • Fixed redis multi operation not connected in time e5f698

    固定的Redis multi操作未及时连接E5F698

  • Fix redis does not support expireAt, geoRadius 749241

    修复redis不支持expireAtgeoRadius 749241

  • Fixed 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 and toArray 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类以添加newFromArraytoArray方法,以利于通过第三方存储( 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返回fd306f4

  • Coroutine file operation writeFile New write failure exception 08c4244

    协程文件操作writeFile新的写入失败异常08c4244

  • RPC new parameter verification 8646fc5

    RPC新参数验证8646FC5

Github (Github)

https://github.com/swoft-cloud/swoft

https://github.com/swoft-cloud/swoft

翻译自: https://habr.com/en/post/476508/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值