On June 10th, 2018 was released the first alfa version of the new major update to the Yii framework 3.0.0
New in Yii 3.0
- Package “ezyang/htmlpurifier” has been made optional and is not installed by default
- Yii autoloader is removed in favor of Composer’s PSR-4 implementation
- Removed HHVM-specific code
- Removed APC support in ApcCache, APCu works as before
- The behavior of
yii\grid\DataColumn::$filterInputOptions
is changed when the default value is overwritten - Moved masked input field widget into separate extension https://github.com/yiisoft/yii2-maskedinput
- Mail message composition extracted into the separate class,
yii\mail\Composer
which setup is available viayii\mail\BaseMailer::$composer
- Renamed
yii\base\InvalidParamException
toyii\base\InvalidArgumentException
- Updated the fallback date formats used when no
intl
extension is installed to match the defaults of the latest ICU version - Removed XCache and Zend data cache support as caching backends
- Updated
yii\widgets\ActiveField::hint()
method signature to matchlabel()
- Removed
yii\base\Object::className()
in favor of native PHP syntax::class
, which does not trigger autoloading - Minimum required version of PHP is 7.1 now
- Consistent behavior of
run()
method in all framework widgets. All return the result now for better extensibility - Signature of
yii\web\RequestParserInterface::parse()
changed to acceptyii\web\Request
instance as a sole argument - CUBRID database support removed
- PJAX support removed
- Packages ‘captcha’, ‘jquery’, ‘rest’, ‘mssql’ and ‘oracle’ have been extracted into extensions
- Removed methods marked as deprecated in 2.0.x
Enhancements in Yii 3.0
- Use
random_int()
instead ofmt_rand()
to generate cryptographically secure pseudo-random integers - objects
yii\helpers\ReplaceArrayValue
,yii\helpers\UnsetArrayValue
now support restoring after being exported withvar_export()
function - Added
yii\web\AssetConverter::$isOutdatedCallback
allowing a custom check for outdated asset conversion result - Added serialization abstraction layer under
yii\serialize\*
namespace - Added support for PSR-3 ‘Logger’
- optimized
yii\filters\AccessController
on processing access rules - Add
$checkAjax
parameter to methodyii\web\Controller::redirect()
which controls redirection in AJAX and PJAX requests - Mail view rendering encapsulated into
yii\mail\Template
class allowing rendering in isolation and access toyii\mail\MessageInterface
instance via$this->context->message
inside the view - CAPTCHA rendering logic extracted into
yii\captcha\DriverInterface
, which instance is available viayii\captcha\CaptchaAction::$driver
field yii\web\Request::getBodyParams()
now generates 415 ‘Unsupported Media Type’ error on invalid or missing ‘Content-Type’ header- The result of
yii\web\Request::getBodyParams()
now includes uploaded files - Uploaded file retrieve methods have been moved from
yii\http\UploadedFile
toyii\web\Request
- Added support for PSR-7 ‘HTTP Message’
- Caching implementation refactored according to PSR-16 ‘Simple Cache’ specification
You can download and test the latest release here
We will keep you updated with all latest changes in the Yii framework.