What is Swoft?
Swoft is a PHP microservices coroutine framework based on the Swoole extension. Like Go, Swoft has a built-in coroutine web server and a 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, powerful global dependency injection container, comprehensive service governance, flexible and powerful AOP, standard PSR specification implementation and so on.
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.
Github
https://github.com/swoft-cloud/swoft
Swoft v2.0.6
Swoft has entered the official 2.0 version from this version.
We have made a lot of improvements and optimizations in this version, and the http server has better performance. It also fixes the bugs left over from the previous ones.
Two new development tools have been added and improved for developers to use:
swoft/swoole-tracker
can help developers resolve link tracking, memory leaks, blocking checks, and performance analysisswoft-cli
now supports basic application skeleton and component structure creation, as well as class file generation
Debugging Tool(swoft-swoole-tracker)
The Swoft debug tool helps developers address link tracking, memory leaks, blocking checks, and performance analysis.
Install components:
composer require swoft/swoole-tracker
Configure middleware:
return [
// ...
'httpDispatcher' => [
// Add global http middleware
'middlewares' => [
// ...
\Swoft\Swoole\Tracker\Middleware\SwooleTrackerMiddleware::class,
],
],
// ...
];
Link Tracking
Service Monitoring
Service status
Memory leak
Blocking detection
Development Tools(swoft-cli)
swoft-cli Added scene function class generation (controller, middleware, tasks, etc.);
provides tools for creating project skeletons and component skeleton scaffolding..
Install:
wget https://github.com/swoft-cloud/swoft-cli/releases/download/{VERSION}/swoftcli.phar
Class generation
php swoftcli.phar gen:http-ctrl user --prefix /users
Creating a new project
It is now possible to quickly create a new project with swoft-cli. By default, 5 sets of template repositories are provided, which is convenient for users to initialize different project skeletons.
php swoftcli.phar create:application --help
Creating new component
You can also create new components with swoft-cli and help you quickly complete the initial configuration:
php swoftcli.phar create:component --help
Github
https://github.com/swoft-cloud/swoft
Update Log
Fixed:
- Repair the client that uses the current fd as the response message by default when the ws server receives the message 3a8890cf
- Fixed all connections that the ws server got through the swoole server. The type of fd may not be an integer and cause an error. 0fa79d7
- Fix stdlib SystemHelper will be deleted by Defender in Windows 10 71c2893
- Fix
increment/decrement
and get a more connection 94c7171 - Fix Model property
$modelTimestamps
is closed invalid 94c7171 - Fix The log was called before initialization, which may cause the context loss error during the startup phase 5a27704f
- Fix ws server handshake and open use the same top-level coroutine ID. If one is executed first, it may cause subsequent session loss c2cd17a
- Fixed
after
timer passing parameter bug 8ed609a - Fixed timing task memory leaks and log print data loss issues aa6bc32
- Optimized Http server
sgo
processing flow e60d92e - Fixed database inconsistency caused by reconnection in the case of things c2e87f2
- Fixed Aop extreme case return
0
problem 85bc1b1 - Fixed
BeanFactory::createBean()
method creation problem c2e2c89 - Fix RPC error data is a string problem 3a34658
- Fixed
redisCluster
initialization problem 3a60c06 - Fixed
DbException
without throwingDatabase
exceptionCode
3a60c06 - Fixed
getter
andsetter
hump judgment errors forModelAttribute
2e2f0f1 - Fix
Aggregate
aggregate, return string forcibly convertint
error 7aa98a6 - Repair model
updateCounters
method does not synchronize entity data after update 967d6f8
Update:
- Adjust ws server to automatically close the connection when the worker exits, add switch configuration, you can choose whether to open. 3a8890c
- ws server new event:
MESSAGE_PUSH
OPEN_BEFORE
MESSAGE_RECEIVE
e1b0583
Enhancement:
- Add new logs to cut by time f649df2
- Added log support to pass additional parameters 55d5533
- Adjusted and added some ws server related events for users to use e1b0583
- Model pair
Prop
support 630aad8 - Added connection pool (mysql/redis/rpc) to initiate initial connection a367173
- tcp server supports custom header data packaging and unpacking format when using length packetization a6fbe932
- RPC call error message adjustment d9226b1
- Added operation
Database
exception, print console errorSQL
3a60c06 - New operational data migration
int
series Length support 967d6f8 - Added the original sql method
getRawSql
967d6f8 - Extend
updateOrInsert
andupdateOrCreate
to support self-incrementing parameters 967d6f8
Extra:
Swoftcli
already supports basic application skeleton and component structure creation, as well as class file generation functions.SwoftTracker
support for easy developer debugging