|
| 1 | +# Upgrading to 3.0 |
| 2 | + |
| 3 | +With the release of Zend Framework 2, all components current at that time, |
| 4 | +regardless of history, were tagged as v2 releases; in reality, it was the first |
| 5 | +version of a new framework, as it was a completely new architecture from Zend |
| 6 | +Framework 1. As such, zend-mvc 3.0 marks the second major release of the |
| 7 | +component. |
| 8 | + |
| 9 | +The primary goal for version 3 was to reduce the number of dependencies, and to |
| 10 | +split out unrelated, tangential, or extension functionality. As such, there are |
| 11 | +a number of changes that will impact users. |
| 12 | + |
| 13 | +## Dependency reduction |
| 14 | + |
| 15 | +In order to remove dependencies, we needed to provide alternate ways to ensure |
| 16 | +that default functionality, such as service registration and event listener |
| 17 | +attachment, could still occur. |
| 18 | + |
| 19 | +The solution to this problem was to expose each component as a module. This |
| 20 | +however, raised another problem: you now have to register components as modules |
| 21 | +in your application. |
| 22 | + |
| 23 | +To solve this new problem, we created a new component, |
| 24 | +[zend-component-installer](http://zendframework.github.io/zend-component-installer/). |
| 25 | +Install this in your application now: |
| 26 | + |
| 27 | +```bash |
| 28 | +$ composer require --dev zendframework/zend-component-installer |
| 29 | +``` |
| 30 | + |
| 31 | +Once installed, the component acts as a Composer plugin, and will intercept |
| 32 | +packages marked as components or Zend Framework modules, and register them with |
| 33 | +your application configuration. Components are pushed to the top of the module |
| 34 | +list, while modules are pushed to the end. As a development component, it will |
| 35 | +not be installed in your production distributions. |
| 36 | + |
| 37 | +## Routing |
| 38 | + |
| 39 | +Routing was removed from zend-mvc, and moved to a new component, |
| 40 | +[zend-router](https://zendframework.github.io/zend-router/), which is now a |
| 41 | +dependency of zend-mvc. |
| 42 | + |
| 43 | +The changes that will impact users are: |
| 44 | + |
| 45 | +- [Query route removal](http://zendframework.github.io/zend-router/migration/v2-to-v3/#query-route-removal); |
| 46 | + this route had been deprecated since 2.3.0, and removed for the 3.0 release. |
| 47 | +- [Namespace changes](http://zendframework.github.io/zend-router/migration/v2-to-v3/#namespace-change); |
| 48 | + with the separation to the zend-router component, all routes changed |
| 49 | + namespaces from `Zend\Mvc\Router` to `Zend\Router`. |
| 50 | + |
| 51 | +Follow the links above for more details on these changes, and how to migrate |
| 52 | +your code. |
| 53 | + |
| 54 | +## Console tooling |
| 55 | + |
| 56 | +Console tooling, including console routes, were split off to a new component, |
| 57 | +[zend-mvc-console](https://zendframework.github.io/zend-mvc-console/). If you |
| 58 | +were using the console tooling, install zend-mvc-console: |
| 59 | + |
| 60 | +```bash |
| 61 | +$ composer require zendframework/zend-mvc-console |
| 62 | +``` |
| 63 | + |
| 64 | +(Make sure you've already installed zend-component-installer before you do, to |
| 65 | +ensure the component is registered with your application!) |
| 66 | + |
| 67 | +zend-mvc-console exposes all of the same functionality as was in the v2 series |
| 68 | +of zend-mvc, but most components are in different namespaces. Please read the |
| 69 | +[zend-mvc-console migration guide](http://zendframework.github.io/zend-mvc-console/migration/v2-to-v3/) |
| 70 | +for full details of what changes you may need to make to your application to |
| 71 | +ensure console tooling continues to work. |
| 72 | + |
| 73 | +> ### Migrate your console tooling |
| 74 | +> |
| 75 | +> Due to the amount of integration required to support console tooling via the |
| 76 | +> MVC, we do not plan on supporting zend-mvc-console long-term. As such, we |
| 77 | +> recommend migrating your code to use standalone tools such as |
| 78 | +> [zf-console](https://github.com/zfcampus/zf-console) or |
| 79 | +> [Aura.Cli](https://github.com/auraphp/Aura.Cli). |
0 commit comments