Back to Hyperf

3.2 Upgrade Guide

docs/en/upgrade/3.2.md

3.2.11.6 KB
Original Source

3.2 Upgrade Guide

  • Version 3.2 mainly changes the minimum version of PHP to 8.2.
  • Upgrade symfony/* components to support ^6.0 || ^7.0.
  • Upgrade phpunit/phpunit to ^11.0.

Break Changes

  1. The async-queue component renamed JobInterface::getQueueName() to getPoolName().
php
<?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';
    }
}
  1. The logger configuration structure has changed. Refer to #7563.

  2. The cache configuration structure has changed. Refer to #7594.

  3. When using swow, add the response emitter dependency.

php
<?php
// config/autoload/dependencies.php

use Hyperf\Contract\ResponseEmitterInterface;
use Hyperf\Engine\ResponseEmitter;

return [
    ResponseEmitterInterface::class => ResponseEmitter::class,
];

Dependencies Upgrade

  • Upgrade the php version to >=8.2.
  • Upgrade elasticsearch/elasticsearch to ^8.0 || ^9.0.
  • Upgrade nikic/php-parser to 5.6.
  • Upgrade symfony/* components to ^6.0 || ^7.0.
  • Upgrade phpunit/phpunit to ^11.0.
  • Upgrade google/protobuf to ^3.6.1 || ^4.2.
  • Upgrade guzzlehttp/guzzle to ^7.0.

Notice

If you have upgraded to PHP 8.4, fgetcsv and fputcsv now require a default value for the escape parameter.

php
fputcsv($fp, $fields, escape: '');
fgetcsv($fp, escape: '');