BC breaks
- The framework removes
@Annotationsupport, and usesPHP8native annotationAttribute. Before updating, be sure to check whether the project has been replaced byAttribute.
The following script can be executed to convert Doctrine Annotations to PHP8 Attributes.
Note: This script can only be executed under version 2.2
composer require hyperf/code-generator
php bin/hyperf.php code:generate -D app- Database Model upgrade script
Because the model base class has added type support for member variables, you need to use the following script to upgrade it to a new version.
composer require hyperf/code-generator
php vendor/bin/regenerate-models.php $PWD/app/Model- The framework adds more type restrictions to the class library, so when updating from
2.2to3.0, you need to run a static check to make sure it is works.
composer analysis- The framework modifies the
Http statusreturned bygRPC Serveraccording to thegRPCspecification. It is fixed at 200, andgRPC Serverreturns the correspondingstatus code. Service upgrade to version 3.x
Dependencies Upgrade
- Upgraded
php-amqplib/php-amqplibto^3.1; - Upgraded
phpstan/phpstanto^1.0; - Upgraded
mix/redis-subscribetomix/redis-subscriber:^3.0 - Upgraded
psr/simple-cacheto^1.0|^2.0|^3.0 - Upgraded
monolog/monologto^2.7|^3.1 - Upgraded
league/flysystemto^1.0|^2.0|^3.0
Added
- #4196 Added
Hyperf\Amqp\IO\IOFactorywhich used to create amqp io by yourself. - #4304 Support
$suffixfor traitHyperf\Utils\Traits\StaticInstance. - #4400 Added
$descriptionwhich used to set command description easily forHyperf\Command\Command. - #4277 Added
Hyperf\Utils\IPReaderto get local IP. - #4497 Added
Hyperf\Coordinator\Timerwhich can be stopped safely. - #4523 Support callback conditions for
Conditionable::when()andConditionable::unless(). - #4663 Make
Hyperf\Utils\StringableimplementsStringable. - #4700 Support coroutine style server for
socketio-server. - #4852 Added
NullDisableEventDispatcherto disable event dispatcher by default. - #4866 #4869 Added Annotation
Scenewhich use scene in FormRequest easily. - #4908 Added
Db::beforeExecuting()to register a hook which to be run just before a database query is executed. - #4909 Added
ConsumerMessageInterface::getNums()to change the number of amqp consumer by dynamically. - #4918 Added
LoadBalancerInterface::afterRefreshed()to register a hook which to be run after refresh nodes. - #4992 Added config
amqp.enablewhich used to control amqp consumer whether to start automatically and producer whether to declare automatically. - #4994 #5016 Added component
hyperf/database-pgsqlwhich you can be used to connect pgsql server. - #5007 Support for SSL encrypted connection to Redis.
- #5046 Added
Hyperf\Database\Model\Concerns\HasAttributes::getRawOriginal(). - #5052 Support parsing IPv6 host.
- #5061 Added config
symfony.event.enableto control whether to useSymfonyEventDispatcher. - #5163 Added
Pipeline::thenReturn()method to run pipes and return the result - #5160 Added
$dictionaryforStr::slug, your can rewrite some tags easily. - #5186 Added option
configfor commandserver:watch. - #5206 Support the transformation of object type to AST nodes.
- #5211 Added Annotation
CacheAheadwhich used to cache data ahead. - #5227 Added
Hyperf\WebSocketServer\Sender::getResponses(). - #5250 Added
defer_releaseconfig inhyperf/db - #5261 Added requirement
ext-posixforwatcher.
Optimized
- #4147 Optimized code for nacos which you can use
http://xxx.com/yyy/instead ofhttp://xxx.com:8848/to connectnacos. - #4367 Optimized
DataFormatterInterfacewhich uses object instead of array as inputs. - #4547 Optimized code of
Str::containsStr::startsWithandStr::endsWithbased onPHP8. - #4596 Optimized
Hyperf\Context\Contextwhich supportcoroutineIdforset()override()andgetOrSet(). - #4658 The method name is used as the routing path, when the path is null in route annotations.
- #4668 Optimized class
Hyperf\Utils\Strwhose methodspadBothpadLeftandpadRightsupportmultibyte. - #4678 Close all another servers when one of them closed.
- #4688 Added
SafeCallerto avoid server shutdown which caused by exceptions. - #4715 Adjust the order of injections for controllers to avoid inject null preferentially.
- #4865 No need to check
Redis::isConnected(), because it could be connected defer or reconnected after disconnected. - #4874 Use
waitinstead ofparallelfor coroutine style tcp server. - #4875 Use the original style when regenerating models.
- #4880 Support
ignoreAnnotationsforAnnotation Reader. - #4888 Removed useless
Hyperf\Di\ClassLoader::$proxies, because merge it intoComposer\Autoload\ClassLoader::$classMap. - #4905 Removed the redundant parameters of method
Hyperf\Database\Model\Concerns\HasEvents::fireModelEvent(). - #4949 Removed useless
call()fromCoroutine::create(). - #4961 Removed proxy mode from
Hyperf\Di\ClassLoaderand OptimizedComposer::getLoader(). - #4981 Confirm before proceeding with the action when using
ConfirmableTrait, such asmigratecommand. - #5017 Check validity of file descriptor before sending message to it when using
socketio-server. - #5029 Removed useless method
call()fromcallable function. - #5078 Optimized code about creating exception from another exception.
- #5079 Catch exception for function
deferby default.
Changed
- #4199 Changed the
publicproperty$messagetoprotectedforHyperf\AsyncQueue\Event\Event. - #4214 Renamed
$circularDependencesto$checkCircularDependenciesforDag. - #4225 Split
hyperf/coordinatorfromhyperf/utils. - #4269 Changed the default priority of listener to
0from1. - #4345 Renamed
Hyperf\Kafka\Exception\ConnectionCLosedExceptiontoHyperf\Kafka\Exception\ConnectionClosedException. - #4434 The method
Hyperf\Database\Model\Builder::insertOrIgnorewill be return affected count. - #4495 Changed the default value to
nullforHyperf\DbConnection\Db::__connection(). - #4460 Use
??instead of?:for$callbackwhen usingStringable::when(). - #4502 Use
Hyperf\Engine\Channelinstead ofHyperf\Coroutine\Channelinhyperf/reactive-x. - #4611 Changed return type to
voidforHyperf\Event\Contract\ListenerInterface::process(). - #4669 Changed all annotations which only support
PHP>=8.0. - #4678 Support event dispatcher for command by default.
- #4680 Stop processes which controlled by
ProcessManagerwhen server shutdown. - #4848 Changed
$value.timeoutto$options.timeoutforCircuitBreaker. - #4930 Renamed method
AnnotationManager::getFormatedKey()toAnnotationManager::getFormattedKey(). - #4934 Throw
NoNodesAvailableExceptionwhen cannot select any node from load balancer. - #4952 Don't write pid when the
settings.pid_fileis null when using swow server. - #4979 Don't support database commands by default, please require
hyperf/devtoolor set them inautoload/commands. - #5008 Removed array type of
Trace Annotation, because don't support array. - #5036 Changed grpc server StatsCode and serializeMessage.
- #5601 Don't use
Hyperf\Framework\SymfonyEventDispatcherby default, if you listen symfony events, you must opensymfony.event.enable. - #5079 Use
(string) $throwableinstead ofsprintfforHyperf\ExceptionHandler\Formatter\FormatterInterface::format(). - #5091 Move
JsonableandXmlabletocontractfromutils. - #5092 Move
MessageBagandMessageProvidertocontractfromutils. - #5204 Transform the type of param
$serverinHyperf\WebSocketServer\Server::deferOnOpen()tomixed. - #5239 Throw exception when using
chunkByIdbut the column is not existed.
Swow Supported
- #4756 Support
hyperf/amqp. - #4757 Support
Hyperf\Utils\Coroutine\Locker. - #4804 Support
Hyperf\Utils\WaitGroup. - #4808 Replaced
Swoole\Coroutine\ChannelbyHyperf\Engine\Channelfor all components. - #4873 Support
hyperf/websocket-server. - #4917 Support
hyperf/load-balancer. - #4924 Support TcpServer for
hyperf/server. - #4984 Support
hyperf/retry. - #4988 Support
hyperf/pool. - #4989 Support
hyperf/crontab. - #4990 Support
hyperf/nsq. - #5070 Support
hyperf/signal.
Removed
- #4199 Removed deprecated handler
Hyperf\AsyncQueue\Signal\DriverStopHandler. - #4482 Removed deprecated
Hyperf\Utils\Resource. - #4487 Removed log warning from cache component when the key is greater than 64 characters.
- #4596 Removed
Hyperf\Utils\Context, please useHyperf\Context\Contextinstead. - #4623 Removed AliyunOssHook for
hyperf/filesystem. - #4667 Removed
doctrine/annotations, please usePHP8 Attributes. - #5226 Removed
WARNINGlog message when amqp connection restart.
Deprecated
Hyperf\Utils\Contracts\Arrayablewill be deprecated, please useHyperf\Contract\Arrayableinstead.Hyperf\AsyncQueue\Messagewill be deprecated, please useHyperf\AsyncQueue\JobMessageinstead.Hyperf\Di\Container::getDefinitionSource()will be deprecated.
Fixed
- #4549 Fixed bug that
PhpParser::getExprFromValue()does not support assoc array. - #4835 Fixed the lost description when using property
$descriptionand$signatureforhyperf/command. - #4851 Fixed bug that prometheus server will not be closed automatically when using command which enable event dispatcher.
- #4854 Fixed bug that the
socket-ioclient always reconnect when using coroutine style server. - #4885 Fixed bug that
ProxyTrait::__getParamsMapcan not work when using trait alias. - #4892 #4895 Fixed bug that
RedisAdapter::mixSubscribecannot work cased by redis prefix when usingsocketio-server. - #4910 Fixed bug that method
ComponentTagCompiler::escapeSingleQuotesOutsideOfPhpBlocks()cannot work. - #4912 Fixed bug that websocket connection will be closed after 10s when using
Swow. - #4919 #4921 Fixed bug that rpc connections can't refresh themselves after nodes changed when using
rpc-multiplex. - #4920 Fixed bug that the routing path is wrong (like
//foo) when the routing prefix is end of '/'. - #4940 Fixed memory leak caused by an exception which occurred in
Parallel. - #5100 Fixed bug that the tag
continuecannot work when usingview-engine. - #5121 Fixed bug that the SQL is not valid but the correct error message cannot be obtained when using
pgsql. - #5132 Fixed bug that the exit code of command does not work when the exception code isn't int.
- #5142 Fixed bug that the method
Request::parseHostdoes not work when host is invalid. - #5199 Fixed bug that
RedisSentinelcan't support empty password. - #5221 Fixed bug that
PGSqlSwooleConnection::affectingStatement()can't work when thesqlis wrong. - #5223 Fixed bug that
KeepaliveConnection::isTimeout()can't work when using swow. - #5229 Fixed bug that proxy class will be generated failed when using parameters who allow null in constructor.
- #5252 Fixed bug that generate rpc-client failed when the interface has parent interfaces.
- #5268 Fixed bug that abstract methods will be written by
di.
New Contributors
- @mmfei made their first contribution in #4434
- @zhuangyuanhui made their first contribution in #4527
- @flc1125 made their first contribution in #4580
- @Stitch-June made their first contribution in #4620
- @yanghaixi made their first contribution in #4655
- @her-cat made their first contribution in #4657
- @gilbertomarcomini made their first contribution in #4683
- @xskjs888 made their first contribution in #4689
- @wilbur-yu made their first contribution in #4763
- @simon-tu-ke made their first contribution in #4790
- @barbluz made their first contribution in #4729
- @greezen made their first contribution in #4849
- @DGdisigner made their first contribution in #4892
- @wisp-x made their first contribution in #4910
- @kingIZZZY made their first contribution in #5016
- @Ahmard made their first contribution in #5017
- @JeaNile made their first contribution in #5038
- @gaotiefeng made their first contribution in #5046
- @rust17 made their first contribution in #5102
- @wenccc made their first contribution in #5132
- @lucasdotvin made their first contribution in #5163
- @aldok10 made their first contribution in #5171
- @ReinanHS made their first contribution in #5131
- @xuanyanwow made their first contribution in #5202
- @lihq1403 made their first contribution in #5204
- @devin110 made their first contribution in #5254
- @joandysson made their first contribution in #5270
Full Changelog: v2.2.25...v3.0.0