After updating Yii 2 to the latest version based on Composer, the loss analysis of the package: guzzlehttp guzzle
1. Reference URL:https://www.shuijingwanwq.com/2020/01/19/3869/, upgrade Yii Framework from version 2.0.15.1 to 2.0.31
2. In some use: \guzzlehttp\json_encode, \guzzlehttp\json_decode Error in the program, the final analysis found that the reason is that the directory: /vendor/guzzlehttp/guzzle, /vendor/guzzlehttp/promises no longer exists. as shown in Figure 1
After careful analysis, find the second step in the reference URL, run the Composer Update , uninstalled: guzzlehttp/promises, guzzlehttp/guzzle, as shown in Figure 2
4. The problem of step 2, finally through the YII help class JSON:https://www.yiiframework.com/doc/api/2.0/yii-helpers-jsonto be resolved, perform the corresponding replacement operation
\GuzzleHttp\json_decode
\yii\helpers\Json::decode
\GuzzleHttp\json_encode
\yii\helpers\Json::encode
5. In a branch of Yii 2 that is still: 2.0.15.1, use dependency detection Depends Commands can find out whether a package that is already installed in your project is being depended on by other packages, and list them. Conclusion: guzzlehttp/promises depends on guzzlehttp/guzzle, guzzlehttp/guzzle depends on codeception/base, codeception/base depends on yiisoft/yii2-app-advanced. as shown in Figure 3
PS E:\wwwroot\pcs-api-feature-config-group-task-step> ./yii
This is Yii version 2.0.15.1.
The following commands are available:
- asset Allows you to combine and compress your JavaScript and CSS files.
asset/compress (default) Combines and compresses the asset files according to the given configuration.
asset/template Creates template of configuration file for [[actionCompress]].
- cache Allows you to flush cache.
cache/flush Flushes given cache components.
cache/flush-all Flushes all caches registered in the system.
cache/flush-schema Clears DB schema cache for a given connection component.
cache/index (default) Lists the caches that can be flushed.
- cmc-console-user 框架服务控制台的用户
cmc-console-user/sync 同步框架服务控制台的用户模型(Http)至框架服务控制台的用户模型(R
edis)
- config-column-user 栏目人员配置
config-column-user/sync 同步框架服务控制台的用户模型(Http)至栏目人员配置模型(MySQL)
- fixture Manages fixture data loading and unloading.
fixture/load (default) Loads the specified fixture data.
fixture/unload Unloads the specified fixtures.
- gii This is the command line version of Gii - a code generator.
gii/controller Controller Generator
gii/crud CRUD Generator
gii/extension Extension Generator
gii/form Form Generator
gii/index (default)
gii/model Model Generator
gii/module Module Generator
- help Provides help information about console commands.
help/index (default) Displays available commands or the detailed information
help/list List all available controllers and actions in machine readable format.
help/list-action-options List all available options for the $action in machine readable format.
help/usage Displays usage information for $action.
- log 日志
log/delete 日志的删除
- message Extracts messages to be translated from source files.
message/config Creates a configuration file for the "extract" command using command line options
specified.
message/config-template Creates a configuration file template for the "extract" command.
message/extract (default) Extracts messages to be translated from source code.
- migrate Manages application migrations.
migrate/create Creates a new migration.
migrate/down Downgrades the application by reverting old migrations.
migrate/fresh Truncates the whole database and starts the migration from the beginning.
migrate/history Displays the migration history.
migrate/mark Modifies the migration history to the specified version.
migrate/new Displays the un-applied new migrations.
migrate/redo Redoes the last few migrations.
migrate/to Upgrades or downgrades till the specified version.
migrate/up (default) Upgrades the application by applying new migrations.
- plan-task 选题任务
plan-task/close 关闭选题任务
- serve Runs PHP built-in web server.
serve/index (default) Runs PHP built-in web server.
To see the help of each command, enter:
yii help
PS E:\wwwroot\pcs-api-feature-config-group-task-step> composer depends guzzlehttp/promises
guzzlehttp/guzzle 6.3.3 requires guzzlehttp/promises (^1.0)
PS E:\wwwroot\pcs-api-feature-config-group-task-step> composer depends guzzlehttp/guzzle
codeception/base 2.5.2 requires guzzlehttp/guzzle (>=4.1.4 <7.0)
PS E:\wwwroot\pcs-api-feature-config-group-task-step> composer depends codeception/base
shuijingwan/yii2-app-advanced dev-feature-config-group-task-step requires (for development) codeception/base (^2.2.3)
6. Check the composer.json of the two versions of codeception/base, the yii framework is upgraded to 2.0.31 from version 2.0.15.1, which leads to codeception/base Upgrading from version 2.5.2 to 2.5.6, version 2.5.6 of Codeception/Base has given up on guzzlehttp/guzzle. It can be found that the dependency type of Codeception/Base is: require-dev, so it can only be used for development stage, not for production stage.
"require-dev": {
"yiisoft/yii2-debug": "~2.0.0",
"yiisoft/yii2-gii": "~2.0.0",
"yiisoft/yii2-faker": "~2.0.0",
"codeception/base": "^2.2.3",
"codeception/verify": "~0.3.1"
},


