zored / zf2-to-3
从 ZF2 迁移到 ZF3 的技巧。
1.0
2018-01-19 21:38 UTC
Requires
- php: >=5.6
- zendframework/zend-servicemanager: >=2.0.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.10
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^5.0
This package is not auto-updated.
Last update: 2024-09-29 06:20:10 UTC
README
从 ZF2 迁移到 ZF3 的技巧。
为什么?
为了在完全迁移到 ZF3 之前快速修复你的代码。
如何?
- 在抽象工厂中使用
use \ZF2TO3\ZF2To3AbstractFactoryTrait; - 在工厂中使用
use \ZF2TO3\ZF2To3FactoryTrait; - 如果控制器依赖于服务定位器,则在控制器自身中使用
use \ZF2TO3\ZF2To3ControllerTrait; - 使用
use \ZF2TO3\ZF2To3ServiceLocatorAwareTrait;和自定义构造函数来 去除ServiceLocatorAware。 - 更改控制器配置
<?php return [ 'controllers' => [ // BEFORE: 'invokables' => [ 'App\Some' => \App\SomeController::class ], // AFTER: 'factories' => [ // Controller should be real class: \App\SomeController::class => \ZF2TO3\ZF2To3ControllerFactory::class ], ], ];
- 阅读 迁移文档 并去除这些技巧!