Release v3.2.0
Break Changes
-
The BC of Carbon component
Carbon::createFromTimestamp()don't read the default timezone bydate_default_timezone_get()forv3.0.Carbon::diffInDays()no longer returns an absolute value by default. Use the$absoluteparameter to control whether the result is absolute.
-
#7625 Renamed
JobInterface::getQueueName()togetPoolName()in async-queue component for terminology consistency.
<?php
// Before
class CustomJob extends \Hyperf\AsyncQueue\Job
{
public function getQueueName(): string
{
return 'custom';
}
}
// After
class CustomJob extends \Hyperf\AsyncQueue\Job
{
public function getPoolName(): string
{
return 'custom';
}
}<?php
use Carbon\Carbon;
$t = time();
# The break usage
Carbon::createFromTimestamp($t, date_default_timezone_get());
# The correct usage
Carbon::createFromTimestamp($t, date_default_timezone_get());- The
loggerconfiguration structure has been changed. Please refer to #7563.
<?php
// Before
return [
'default' => [
'driver' => 'daily',
'path' => BASE_PATH . '/runtime/logs/hyperf.log',
'level' => env('LOG_LEVEL', 'debug'),
'days' => 7,
],
];
// After
return [
'default' => 'default',
'channels' => [
'default' => [
'driver' => 'daily',
'path' => BASE_PATH . '/runtime/logs/hyperf.log',
'level' => env('LOG_LEVEL', 'debug'),
'days' => 7,
],
// Add your custom channels here
],
];- The
cacheconfiguration structure has been changed. Please refer to #7594.
<?php
// Before
return [
'default' => [
'driver' => RedisDriver::class,
'packer' => PhpSerializerPacker::class,
'prefix' => 'c:',
],
];
// After
return [
'default' => env('CACHE_DRIVER', 'default'),
'stores' => [
'default' => [
'driver' => RedisDriver::class,
'packer' => PhpSerializerPacker::class,
'prefix' => 'c:',
],
],
];- Added dependencies when using
swow.
config/autoload/dependencies.php
<?php
use Hyperf\Contract\ResponseEmitterInterface;
use Hyperf\Engine\ResponseEmitter;
return [
ResponseEmitterInterface::class => ResponseEmitter::class,
];Warn
- If you have upgraded to PHP 8.4, please note that both the
fgetcsvandfputcsvmethods now require providing a default value for theescapeparameter.
fputcsv($fp, $fields) must be changed to fputcsv($fp, $fields, escape: '')
fgetcsv($fp) must be changed to fgetcsv($fp, escape: '')
Dependencies Upgrade
- Upgrade the php version to
>=8.2 - Upgrade the
elasticsearch/elasticsearchversion to^8.0 || ^9.0 - Upgrade the
nikic/php-parserversion to5.6 - Upgrade the
symfony/*components to^6.0 || ^7.0 - Upgrade the
phpunit/phpunitversion to^11.0 - Upgrade the version of
google/protobufto^3.6.1 || ^4.2. - Upgrade the version of
guzzlehttp/guzzleto^7.0.
Removed
- #7278 Removed abandoned
laminas/laminas-mimepackage. - #7573 Removed deprecated
Hyperf\Serializer\Contract\CacheableSupportsMethodInterfaceinterface. - #7609 Removed backward compatibility code from
Hyperf\AsyncQueue\JobMessageserialization. - #7610 Removed deprecated code scheduled for v3.2 removal, including Collection backward compatibility, ProxyTrait parameter mapping,
ResumeExitCoordinatorListener, SocketIO Futureflagparameter, and WebSocketHandeShakeExceptiontypo alias.
Optimized
- #6804 Optimized the code for reading contents from file when using
Hyperf\Di\ReflectionManager::getAllClassesByFinder(). - #7142 Enhance array shuffle method to support custom random engines.
- #7431 Optimized the
toCssClassesandtoCssStylesmethods by directly using the input array to simplify the code logic. - #7523 Modernize array utilities and JSON validation using PHP 8.4+ functions with polyfills.
- #7620 Added Symfony 7.4 compatibility with batch command registration.
- #7653 Improved
Parser::parseResponsereturn value format by replacingGrpc\StringifyAblewithGoogle\Rpc\Statusobjects for better standardization and code readability. - #7658 Optimized event listener provider by adding cache for non-anonymous event classes to avoid repeated listener resolution.
Added
- #6538 Support to specify the queue name based on the
job. - #6591 Support
v3.0fornesbot/carbon. - #6761 Added
toJsonmethod toHyperf\Contract\Jsonable. - #6794 feat: Add Htmlable contract interface for HTTP responses.
- #7019 Added PDO subclass support for PHP 8.4.
- #7198 Added connection name to
QueryException. - #7202 Added support for elasticsearch
8.x. - #7629 Added support for elasticsearch
9.x. - #7214 Improve
Hyperf\Support\Fluent. - #7247 Added
Hyperf\Pipeline\Pipeline::finally(). - #7274 Support to take multiple items for
shift()andpop()inHyperf\Collection\Collection. - #7302 Added
partition()andreject()toHyperf\Collection\Arr. - #7312 Added
Macroablesupport toHyperf\Context\Context. - #7605 Added
NonCoroutineattribute for flexible test execution control. - #7618 Added a new registration mode for async queue consumer processes that supports automatic registration based on configuration, eliminating the need for manual process registration in
config/autoload/processes.php. - #7621 Added timestamp prefix to
StdoutLoggeroutput format. - #7717 Added package
database-sqlserver.
Changed
- #6760 Changed the default type of
deleted_attodatetimeforhyperf/database. - #7208 Throw exceptions when the value is smaller than zero for
Hyperf\Database\Query\Builder::limit(). - #7372 Use empty string as
escapefor functionstr_getcsv. - #7462 Replaced
influxdb/influxdb-phpintoinfluxdata/influxdb-client-php. - #7563 Changed the
loggerconfiguration structure. - #7594 Changed the
cacheconfiguration structure. - #7615 Renamed
$queueproperty to$poolinConsumerProcessfor async-queue component. - #7625 Renamed
getQueueName()togetPoolName()in async-queue component for terminology consistency. - #7714 Don't support Monolog 2.x, only 3.x is supported.
Fixed
- #6934 Fixed bug that
sortByMany()don't return the same result likesortBy().
New Contributors
- @SkibidiProduction made their first contribution in #7585
- @L4ZARIN3 made their first contribution in #7674
- @NoraClapham made their first contribution in #7703
- @wregis made their first contribution in #7676
- @adhikjoshi made their first contribution in #7607
- @Dmcz made their first contribution in #7695
- @rpmoura made their first contribution in #7372
- @sabinm677 made their first contribution in #7723
- @suyar made their first contribution in #7734
- @ikolossov made their first contribution in #7736
Full Changelog: v3.1.63...v3.2.0