https://github.com/zored/zf2-to-3
Hacks for migrating from ZF2 to ZF3.
https://github.com/zored/zf2-to-3
php zend-framework2 zend-framework3
Last synced: about 1 year ago
JSON representation
Hacks for migrating from ZF2 to ZF3.
- Host: GitHub
- URL: https://github.com/zored/zf2-to-3
- Owner: zored
- Created: 2018-01-19T19:30:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-19T22:04:37.000Z (over 8 years ago)
- Last Synced: 2025-01-13T10:50:44.935Z (over 1 year ago)
- Topics: php, zend-framework2, zend-framework3
- Language: PHP
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ZF2 to 3
[](https://travis-ci.org/zored/zf2-to-3)
[](https://coveralls.io/github/zored/zf2-to-3?branch=master)
Hacks for migrating from ZF2 to ZF3.
## Why?
To fast-fix your code before fully moving to ZF3.
## How?
- `use \ZF2TO3\ZF2To3AbstractFactoryTrait;` in abstract factories.
- `use \ZF2TO3\ZF2To3FactoryTrait;` in factories.
- `use \ZF2TO3\ZF2To3ControllerTrait;` in controller itself if it depends on service locator.
- `use \ZF2TO3\ZF2To3ServiceLocatorAwareTrait;` and custom constructor to [get rid of `ServiceLocatorAware`](https://docs.zendframework.com/zend-mvc/migration/to-v3-0/#servicelocatoraware-initializers).
- Change controller configurations:
```php
[
// BEFORE:
'invokables' => [
'App\Some' => \App\SomeController::class
],
// AFTER:
'factories' => [
// Controller should be real class:
\App\SomeController::class => \ZF2TO3\ZF2To3ControllerFactory::class
],
],
];
```
- Read the [migration docs](https://docs.zendframework.com/zend-mvc/migration/to-v3-0/) and get rid of these hacks!