I'm wondering if ZF2 is based entierly on MOVE instead of the classic MVC.
Somewhere I read that is really bases on MOVE (http://cirw.in/blog/time-to-move-on) but e.g. in the "getting started tutorial" (http://zf2.readthedocs.org/en/latest/user-guide/overview.html) they are saying "creating a simple database driven application using the Model-View-Controller paradigm".
So, what is it now based on? Does it support both?
I'm a bit confused. What are the difference at MVC between ZF1 and ZF2?
Thanks
MOVE (Models, Operations, Views and Events)
MVC (Models, Views, Controllers)
The problem with MVC is that you end up stuffing too much code into controllers,
to overcome this problem MOVE is another possible option to choose in zf2 projects,
Because in this architecture you can split your controller into Events and Operations.
Question: Is ZF2 based entirely on the MOVE architecture?
I don't think ZF2 is designed entirely on MOVE architecture.
ZF2 follows the SOLID object oriented design principle with loosely coupled MVC architecture which provide more flexibility in terms of usability.
Question: Can I develop my projects using the MOVE architecture in ZF2?
Yes ZF2 provides you with everything to support both architectures (MOVE, MVC).
It provides Models, Views, Controllers(Operations), Events.
It is up to the developer which architecture he would like to use.
ZF1 and ZF2 is compared in another thread.
MVC or MOVE
SOLID Object Oriented Programing
I am still a beginner in zf2, I am writing here since I had ported my zf1 code entirely to new zf2 framework. I could only say the new framework have lot of advantages and once you get certain new concepts and feature. you can save lot of time developing new project by reusing of modules/components etc.
In zf2 most of the library components are designed to be standalone, i.e loosely coupled, as said it gives more flexibility and a task can be done in many ways (just like PHP is). The main advantage I see is modules, I can split my project to many modules with ease and test individually and integrate very easily without any additional codes. Even I had all my resources like images, css and JavaScript files inside my module folders and access it without any problem (off course with a small code in index.php)
for me ZF1 has fixed rules, flows, etc, and zf2 have liberated flow and rules with new addition of events namespace, configuration and lazy loading, assemble objects, inject dependencies with servicemanger. in zf1 routes are automatic(programmatic), where as in zf2 we need route definition, in zf1 controllers are automatically choosen, where as in zf2 we need to define controllers as invokables, this are few things that take some time to get in once you get the idea you will feel the comfort of using the new zf2 framework
to start with you can do this steps
Learn Service Manager
How Configuration works
How events work
Components wise more or less it works the same as in zf1 (at least in my case)
below are the following advantage I had benefited
Full feel of OOP
Modular application development
Design and then develop to PHP application
Web Application(RIA) platform
Related
Problem:
I’m unsure how to set up multi client application for Symfony so that we would not violate Symfony's best practices and work against the framework.
I would like to have one main Core namespace which would contain all the base model classes. Right next to the core I would like to set up client specific namespaces which would be used, based on client regional setting. For example LocalUS for US market, LocalUK, for UK market etc.
The Local* namespaces should take first priority for including twig templates, and as a fallback use core common shared views (as I understand, this is solvable via twig namespaces). Same goes for controllers and models - these are probably solvable via extending the Core namespaced classes? Is this all solvable via routing and providing paths for these Local* controllers?
I was looking up on github to see if there are any project that have similar setup but I couldn’t find anything.
A little background:
We have an older legacy PHP Application which was built in-house from ground up using plain PHP. As the application has grown over time, it has become hard to maintain good code quality and standards. It’s also very time consuming to teach new developers our application logic, since the application basically follows no standard design patterns and just does it’s own thing. A lot of the underlying code which handles routes, controllers etc seems to work like “magic” that nobody really dares to touch.
It is because of that we would like to migrate our application to Symfony3 framework. I’ve read some articles about the overall process of migrating legacy applications to symfony, and managed to do it with silex pretty well. Silex, however is a bit too lightweight, I found that the assetic service provider had a lot of functionality missing (twig namespacing etc), and decided it would be best if we could move to a full stack symfony framework instead.
Look into Symfony bundles - they do exactly what you need. You create a "base" bundle, than extend it with other bundles. That's how FOSUserBundle works - it provides everything you need, than you extend it and overwrite it.
I'm wondering if ZF2 is based entierly on MOVE instead of the classic MVC.
Somewhere I read that is really bases on MOVE (http://cirw.in/blog/time-to-move-on) but e.g. in the "getting started tutorial" (http://zf2.readthedocs.org/en/latest/user-guide/overview.html) they are saying "creating a simple database driven application using the Model-View-Controller paradigm".
So, what is it now based on? Does it support both?
I'm a bit confused. What are the difference at MVC between ZF1 and ZF2?
Thanks
MOVE (Models, Operations, Views and Events)
MVC (Models, Views, Controllers)
The problem with MVC is that you end up stuffing too much code into controllers,
to overcome this problem MOVE is another possible option to choose in zf2 projects,
Because in this architecture you can split your controller into Events and Operations.
Question: Is ZF2 based entirely on the MOVE architecture?
I don't think ZF2 is designed entirely on MOVE architecture.
ZF2 follows the SOLID object oriented design principle with loosely coupled MVC architecture which provide more flexibility in terms of usability.
Question: Can I develop my projects using the MOVE architecture in ZF2?
Yes ZF2 provides you with everything to support both architectures (MOVE, MVC).
It provides Models, Views, Controllers(Operations), Events.
It is up to the developer which architecture he would like to use.
ZF1 and ZF2 is compared in another thread.
MVC or MOVE
SOLID Object Oriented Programing
I am still a beginner in zf2, I am writing here since I had ported my zf1 code entirely to new zf2 framework. I could only say the new framework have lot of advantages and once you get certain new concepts and feature. you can save lot of time developing new project by reusing of modules/components etc.
In zf2 most of the library components are designed to be standalone, i.e loosely coupled, as said it gives more flexibility and a task can be done in many ways (just like PHP is). The main advantage I see is modules, I can split my project to many modules with ease and test individually and integrate very easily without any additional codes. Even I had all my resources like images, css and JavaScript files inside my module folders and access it without any problem (off course with a small code in index.php)
for me ZF1 has fixed rules, flows, etc, and zf2 have liberated flow and rules with new addition of events namespace, configuration and lazy loading, assemble objects, inject dependencies with servicemanger. in zf1 routes are automatic(programmatic), where as in zf2 we need route definition, in zf1 controllers are automatically choosen, where as in zf2 we need to define controllers as invokables, this are few things that take some time to get in once you get the idea you will feel the comfort of using the new zf2 framework
to start with you can do this steps
Learn Service Manager
How Configuration works
How events work
Components wise more or less it works the same as in zf1 (at least in my case)
below are the following advantage I had benefited
Full feel of OOP
Modular application development
Design and then develop to PHP application
Web Application(RIA) platform
I have to migrate an application from Zend Framework 1.12.0 to version 2. There seem to be no migration guides yet. I have already studied ZF2 coding conventions and I adopted dependency injection (Zend\Di) and PHP 5.3 namespaces. My goal is to refactor my ZF1 application into a ZF2 module.
Question: Is it possible to proceed step-by-step with an at least partly working application after every step and avoid huge refactoring steps? If yes, what are the steps?
Here's my idea of such a step-by-step migration, but I don't know if I end up with a working application after every step:
Start by setting up the ZF2 Skeleton Application
Set up a new module (MyApp) and reorganize the contents of my ZF1 application into the MyApp module folder structure. Then set up very basic configuration and bootstrapping and migrate the IndexController by extending it from the ZF2 AbstractActionController. The models (Zend_Db) and views (Zend_View) will be migrated later. The goal here is to have a working IndexController::indexAction which doesn't have many dependencies.
Set up more configuration and bootstrapping (Routing, Translate, Locale, Cache, Db, Acl, ViewHelpers, ...). I'd like to set up the ZF1 versions of these components first and migrate them later one by one.
Migrate the other controllers and set up dependency injection into the controllers either with Zend\Di or by using the ServiceManager.
Set up automatic deployment by making the old phing scripts work with the new directory structure.
Migrate the views (including helpers) and forms to ZF2.
Migrate the models (from Zend_Db either to ZF2 Zend\Db or to Doctrine).
Migrate other ZF1 components one by one (Translate, Locale, Cache, Acl, ...).
Refactoring rehab and long holiday.
However, I will have a workin application after every step only if certain ZF2 components work together with ZF1 components. I have no idea if it's e.g. possible to use ZF1 views (and view helpers) with ZF2 controllers.
Migration from Zend Framework 1
This guide is intended to provide tools and strategies for migrating from Zend Framework 1 to Zend Framework 2. There is no single solution that will work for every project, nor any tools to automate the process.
In this guide, we will cover the following:
Tools for namespacing your code.
Tools for consuming Zend Framework 2 within your Zend Framework 1 application.
Strategies for running Zend Framework 2 and Zend Framework 1 in parallel.
Strategies for making your code easier to migrate, focussing primarily on clean separation of your domain logic and the MVC layer.
Strategies for migrating the MVC layer.
Strategies for migrating your domain layer.
http://framework.zend.com/manual/2.1/en/migration/overview.html
Somewhere it was once written that it will be easy peasy with some intermediate layer but I never saw any links or anything in the library that looked just remotely like it.
Now the only thing and latest information you can find is in the documentation's Overview page. It is this:
Note ZF2 is not backward compatible with ZF1, because of the new features in PHP 5.3+ implemented by the framework, and due to major rewrites of many components.
I never expected it to be backwards compatible but the key statement here I believe is the major rewrites of many components.
I've started a new project with ZF2 a few months ago where I only wanted the library; so no MVC which should be easy, right? So far it's been pretty much a nightmare because nothing is the same anymore. Besides some familiar class names or structures the whole framework has been completely rewritten from the ground up.
Things I loved, used a lot and knew by heart like forms, cache or session are completely different. For my project it has cost me a lot of time with no benefit. One of the key objects for ZF2 I thought was overhaul the documentation which is as of these written way worse than the previous one.
For my other existing ZF1.x projects I don't see how to manage an upgrade except to completely rewrite the application.
From the Zend Framework 2 FAQ:
I have an application built with Zend Framework 1 – will I be able to migrate it to the new version?
Absolutely. An important part of Zend Framework 2 is the migration layer that will allow ZF 1 code to run on the new ZF 2 engine, which will be made available in the future. With it, you will be able to add new ZF 2 code, and refactor existing code, at a controlled pace.
However, at this point, I have not heard of any actual migration layer. We can only hope there will be, but at this point, I have my doubts.
We have been migrating a large application from Zend Framework 1 to Zend Framework 2 over the past year. We started out with simple things like namespacing, and slowly worked our way into the various library components. Ultimately, we ended up editing Zend_Layout to work with Zend\Filter, Zend_Form to work with Zend\Filter and Zend\Json, Zend_Navigation to work with Zend\Permissions\Acl, etc. This helped us to eliminate almost all ZF1 components with the exception of the ZF1 application structure which includes four classes Zend_Application, Zend_Config, Zend_Controller, and Zend_Layout. The final piece of the puzzle is the implementation of Zend\Mvc\Application and Zend\View, the remainder is ZF2-ready.
Most recently, we created a proxy of sorts to hook into Zend\Mvc\Application and ZF2 modules from ZF1. This has been extremely helpful. I detailed the steps over at http://webjawns.com/2013/11/migrating-to-zf2-integrating-composer-and-doctrineormmodule/.
In summary...
Convert prefixes to namespaces (Model_ to Model\, Application_Controller to Application\Controller, etc.)
Replace non-MVC components with ZF2 counterparts including autoloader
Create ZF2 application structure and hooks to begin utilizing ZF2 modules
Move controllers and views (still working on a plan for this one)
Can individual classes from CodeIgniter be integrated into other frameworks / projects without using the underlying framework to build the application?
I believe this can be achieved in Zend if I only wanted to use specific classes (such as Zend_DB, Zend_Validate, etc…) by linking to just that component without needing to use the underlying framework for building the application. Can someone please confirm this? In addition, what other frameworks (e.g., Symphony, CakePHP) have this ability, specifically CodeIgniter?
Just look at the class definitions and see what they depend on. Likely they are tightly coupled to the rest of the framework.
ZF was defined from the beginning as a collection of components, or tools, which is why stealing individual classes is so easy - it was intentional.
CI is meant to be extremely loosely coupled, so perhaps OP will have some luck. I don't have any examples however
I'm not sure if this is possible, but let's say you want to build a CMS, but you're torn between 2 frameworks because each has some features that you like. Is it possible to create the CMS with both framewoks? Does this approach have merits or pitfalls?
Speaking strictly about the Zend Framework (ZF) I would say yes. ZF components are written to be as independent from other components as possible. I would say that it would not be very difficult (It may actually be quite common) to integrate libraries of ZF into other frameworks like Cake, Symfony, or Codeigniter.
Is it possible to create the CMS with both framewoks?
While it's possible to use components from the Zend Framework inside other Frameworks / CMSs - this may be the case with other component libraries as well, but Zend's the most modular one that I know - It's usually not a good idea to mix two full-blown Frameworks.
Many central functions like MVC structures, URL routing, the database layer, Unit testing, error management and so on are by nature unable to be served by two frameworks at once without massive friction. Also, you're likely to get problems when one of the frameworks needs to be updated.
I would recommend to pick the framework that covers most of what you need, and try and add the missing features using plug-ins or own modifications.
Your question is too abstract.
For instance Zend Framework is more to be a library of specific functionalities ready-to-be-include into Your codebase then some closed development environment like for instance Symfony framework.
Thanks to it can be ZF simply included into your codebase (and Symfony too).
Symfony Framework compared to it is closed solution depending on front server environment so you cannot use it like some other framewor's slave.
It would really depend on which things you liked about both...
Zend Frameowrk is more like a library, so you can pick and choose components from it. Symfony also has some re-usable components you can use.
Really, you can do anything... it just depends how much work you want to do, and how willing you are to modify the framework code. Note: most other PHP frameworks are not nearly as flexible as Zend Framework (next up probably being Symfony).
This sounds very messy, so I'd advise against it, unless you use it in the fashion I've described above. It's easy to pull ZF or Symfony components into other frameworks, but not the other way around.
Hope this helps.
The composability of most frameworks is such that that is most likely to give you all the disadvantages of both, while simultaneously eliminating most of the individual advantages of both.
It seems to me like one framework will for serve as the core - bootstrapping, MVC stack, routing - while the other will be used to pull in specific functionality - like classes for forms or filtering or interacting with web services, etc.
As much as I prefer Zend Framework for the core - and most everything else - its use-at-will architecture argues for making the other framework the core and pulling in ZF components where you need them.
As #Adrian notes, it's easy to pull in ZF components into a project built primarily on another framework, since ZF is designed with that flexibility in mind. Other frameworks are less accommodating in this regard.
You can do it. Most modern frameworks (Zend, symfony, flow) is capable to use parts of other frameworks. Symfony 2 uses Zend Logger, flow3 uses sfYaml... It is possible tu interchange some components.
But, imho, you should stick to one framework as a core, and use second only to relatively isolated subsystems. Adapter and Facade design patterns can help you to mix them together - some components / clases demands some wrapping before use in non-native environment.
For further reading: http://www.symfony-project.org/book/1_2/17-Extending-Symfony#chapter_17_integrating_with_other_framework_s_components
Of course it is possible and I don't see something wrong with it. For example I used CakePHP and Zend on a relatively large Project which was kind of a cms. CakePHP for the core (Routing, MVC) and Zend for some "Modules". Mainly for PDF, E-Mail (smtp), FTP and a few others that CakePHP was not that good at. With Cake it was fairly easy to use ZF components and didn't feel hacky at all.
In fact, ZF was written to be as independent as possible, so that you can use any component at any time anywhere. Yet, it would not work the other way round (Using ZF as core, and Cake components). Surely it is possible, but a real pain with no benefits. So ZF could be used propably inside of pretty much any other framework and nothing would be wrong with it, imho.