1.4 Upgrade Guide
Please make a backup before upgrading and execute the following command to upgrade
composer require workerman/webman-framework ^1.4.7 && composer require webman/console ^1.2.12 && php webman install
Note
If you are unable to upgrade, it is likely due to using a composer proxy. Please use the following commandcomposer config -g --unset repos.packagist
to restore the official composer data source.
Features and Changes
Application Plugins
Version 1.4 supports application plugins. Please refer to Application Plugins for more information.
Automatic Routing
Version 1.4 supports various complex controller directory rules. For example:
app
app
├── admin
│ └── v1
│ └── v2
│ └── v3
│ └── controller
│ └── Index.php
└── controller
├── v1
│ └── Index.php
└── v2
└── v3
└── Index.php
In other words, the webman/auto-route
plugin is no longer needed.
Controller Reuse Switch
Version 1.4 allows you to disable controller reuse. Set 'controller_reuse' => false,
in config/app.php
, so that a new controller will be reinitialized for each request. That is to say, the __construct()
constructor of the corresponding controller will be triggered for each request, allowing developers to perform some initialization work before handling each request in the constructor.
With controller reuse being able to be disabled, the webman/action-hook
plugin is no longer needed.
Enabling HTTP Service
Version 1.4 supports enabling multiple ports to provide HTTP services. See Slow Business Processing for more information.
View File Configuration
The suffix can only be configured in the options of view.php.
Deprecated Usage
use support\view\Raw;
return [
'handler' => Raw::class,
'view_suffix' => '.php'
];
Correct Usage
use support\view\Raw;
return [
'handler' => Raw::class,
'options' => [
'view_suffix' => '.php'
]
];
Session Driver Namespace Change
Starting from version 1.4.0, webman has changed the namespace of the SessionHandler
class from the original:
use Webman\FileSessionHandler;
use Webman\RedisSessionHandler;
use Webman\RedisClusterSessionHandler;
to
use Webman\Session\FileSessionHandler;
use Webman\Session\RedisSessionHandler;
use Webman\Session\RedisClusterSessionHandler;
To avoid direct errors after the upgrade, the Webman\FileSessionHandler
class will still be retained for some time and will be completely removed in future versions.
This change affects the 'handler'
configuration in config/session.php
.