What is Swoft?

Swoft is a PHP microservices coroutine framework based on the Swoole extension. Swoft can, like Go, have a built-in coroutine network server and common coroutine clients and live in memory, independent of traditional PHP-FPM. There are coroutine operation mode like Go language, flexible annotations like Spring Cloud framework, powerful global dependency injection container, perfect service governance, flexible and powerful AOP, standard PSR specification implementation and so on.

Swoft has built itself into the Spring Cloud of PHP, the best choice for PHP high-performance framework and microservices governance, through three years of accumulation and direction exploration.

Efficient scheduled task at the second level

The following simple lines of code define a scheduled task that executes every second, which can replace the system scheduled task.

<? phpdeclare(strict_types=1); namespace App\Crontab; use Swoft\Crontab\Annotaion\Mapping\Cron; use Swoft\Crontab\Annotaion\Mapping\Scheduled; /** ** Class CronTask ** @scheduled () */ ** * Class CronTask ** @scheduled () */"* * * * * *")
     */
    public function secondTask()
    {
        printf("second task run: %s ", date('Y-m-d H:i:s', time())); }}Copy the code

The scheduled task starts with the service and the following information is displayed:

Exception management

During development, if the error message is a string, it is not convenient for service troubleshooting. If the component is used, all error messages are displayed as follows:

Update the content

Repair (Fixed) :

  • Fixed a bug where premature interrupt request logic could result in incorrect formatting of content-Type F031398
  • Fixed using SGO to create child coroutines without cleaning up the mapping to the top-level coroutine de11AE5b at the end
  • Fixed Xml format parsing method 24D0038
  • Fixed class proxy Unique string issue 444ddeb
  • repaircontext()->get()Existing problems and obsolescenceContext::mustGet()methods6acc1b5
  • Fix interface injection, class name access error 2D9a31f
  • Repair model usepaginateMethod, the result set has no mapped fields3027287
  • Fixed bug 7666969 in Websocket server, when there are multiple workers, actively close connections to non-current workers

Update (Update) :

  • Default worker num Settings passswoole_cpu_numFunction to obtain553f6500
  • The validator is set to optional by default. The user can enable e5B258D by himself
  • No longer throws swoft internalContainerExceptionGo to the user usage layer1e74893
  • The console output of newconfirm selectIsointeraction method0181138a

Enhancement (Enhancement) :

  • Set the console command optionCommandOption, now allows options to describe multi-line informatione5914983
  • Websocket Server all message sending method, support incomingopcodeparameterdc164ffe9
  • The WebSocket module allows you to set the default for the current moduleopcodeFor automatic processing of returned data Settingsopcode 9e3e9672
  • Enhancements to WebSocket-related classes now allow message handling methods to inject more data object typesRequest Response 3d6c60b4
  • When the worker exits, websocket Server will automatically close all connections
  • Add Timer Indicates that the Timer encapsulates EB92EE6
  • The Add Coroutine method encapsulates d8C2B88

At 2.0.5 + validator off by default, need a developer manual open (www.swoft.org/docs/2.x/zh)…

resources

  • Gitee: gitee.com/swoft/swoft
  • Making: github.com/swoft-cloud…
  • Website: www.swoft.org
  • Documents: www.swoft.org/docs