Basic preparation

Before using swoft , you need to have some basic theory of server programming. In the traditional php-fpm development mode, you basically don't need to worry about resources release, shared variables and so on.

But don't worry, in version 2.x, you can do it as easily as in php-fpm mode. If you have used Laravel started, it's faster, because DataBase , Redis and Basic are the same under Laravel .

Getting started

In the swoole resident memory development mode, do not use super global variables to share data, you can use Context instead, do not use curl extension, of course, guzzlehttp underlying is also curl driven, curl not support coroutine, for specific reasons you can refer to swoole Official document

You can use swoft comes with httpClient , which is as fast and guzzlehttp as httpClient , and restores support for concurrent calls. You no longer have to worry about the server CPU going up because of an http request that is too long.

However, in the next swoole will support the curl extension, I believe it will not wait too long.

Of course, there are a lot of details that are described in detail in the documentation, which are not described here.