I am interested in learning Zend Framework 2.x, and I've noted that there are many good books written about ZF 1.8, 1.9, etc... however, I haven't come across any that explicitly states it is for ZF2 (except for one, and it was written in German).
In order to learn ZF, I could sit an learn it through the documentation... however, that sounds rather unsavory, despite the fact that it contains the latest information and arguably is the "best" source. I would like to endeavor in the more abundant sources on versions 1.8 or 1.9 as I learn this framework.
How much overlap is there between 1.8/1.9 to 2.x? I know 2.x uses namespaces and many new PHP 5.3.x features, but are there really that many changes between the implementation of these versions that I would be wasting my time trying to learn anything less than 2.0?
I'm aware that even if there is a large amount of compatibility, I would still have to come back and fill in a few "knowledge gaps". I'm just looking for a quick run down of the framework overall.
Thank you for your time.
Zend Framework 2 is very different from ZF1. It's core has been rewritten and the MVC structure has changed quite a bit.
The blog post announcing ZF2 goes into some detail on what has changed and why so I would recommend reading that. If you haven't used ZF1 extensively, you won't know some of the components they are talking about but that's okay. But as it states, ZF2 will look alien to those familiar with ZF1. Part of this is the new MVC structure and there are many new core components not available before including the ModuleManager, ServiceManager, and EventManager which provide better ways of accomplishing tasks that were more abstract to accomplish in ZF1.
Unless you plan on working with ZF1 projects, there isn't much sense in learning it at this point; I'd jump right into learning ZF2 at this point. If you were to learn ZF2 now and come across a ZF1 application down the road, there will be things you run into you aren't familiar with but largely you should be able to understand what's going on and get in and edit the application and learn what you need to know as you go.
Since the libraries provided by ZF1 and ZF2 are able to be used standalone, it would be possible to use some ZF2 classes in ZF1 as long as those classes aren't too tightly coupled to other classes in ZF2. For example, you can use Zend\Crypt from ZF2 standalone quite easily, but trying to use Zend\Form might be a different story since its tied to views, validators, filters and other classes.
As for learning ZF2, like you said there aren't many books around yet since its so new, but there are a lot of resources available for learning it aside from the reference guide.
I'd recommend looking at Getting Started with ZF2, the ZF2 Skeleton App, as well as the Zend Webinars where you can already find some great ZF2 tutorials including a presentation called Getting Started with ZF2 presented by The Zend Framework project lead Matthew Weier O'Phinney. There's also an upcoming webinar about MVC that's worth registering for (its free).
Hope that answers your question!
Related
We have pretty big application which has about 8 modules (big modules) written using Zend framework 1 and it has been developed for more than 3 years by couple of developers. Also it has a high traffic everyday. We use Amozon s3, Sphinx, Memcache, and some other third party services as well.
Is it a good idea to migrate it to Zend framework 2 ? Because as we went through the doc briefly, it seems Zend framework 2 has been re-written completely. Therefore we think we won't be able to migrate the application easily rather than re-writing the application according to ZF 2.
Valuable ideas would be highly appreciated.
You are correct that ZF2 is a completely different animal. So different, in fact, that there's no one-size-fits-all migration plan/strategy.
However, I recently did a similar migration. It's a fairly complex line-of-business application originally written over approximately 18 months, with a bunch of varied functionality. The main drivers for the decision were the improvements in the module and event systems.
In our case, it turned into a major point release for the product, which ended up including a bunch of UI changes along with all the plumbing.
Assuming you liked ZF1, the good news is that ZF2 is much better framework (as a framework). The ModuleManager, EventManager, Di, and ServiceManager components (and the general MVC-related stuff) are really great, once you grok them. The bad news is that they're a complete departure from ZF1. So you're at the very least signing up to completely overhaul your dispatch and routing, you'll be saying goodbye to Zend_Registry (ServiceManager/ServiceLocator are a huge improvement).
The other bit of good news is that you can almost certainly keep all the old ZF1-type components around for as long as you need them. So if you're relying on Zend_Cache, Zend_Log, Zend_Mail, etc, a little bit of fiddling with autoloader configs should make that possible.
What I'm suggesting is that if you do take the plunge, consider just migrating to ZF2-as-a-framework first, and worry about ZF2-as-a-component-library later.
If you've stuck with the fat-model/skinny-controller paradigm, it's probably feasible to just replace the Controllers, Front-Controller, Zend_Application stuff in a fairly straight-forward way. Once you get that into production, you can then work on removing dependencies on ZF1 components as time permits. In my case, there wasn't much of that, as things were pretty well factored and wrapped (so, for example, moving from Zend_Cache to Zend\Cache was trivial)
Finally, you should know up-front that View-layer stuff (mostly the helper-related stuff) is different too. If you have a bunch of complicated view-related stuff (partials, custom view-helpers, etc) all over the place, you need to anticipate either rewriting them, or finding a way to use the old Zend_View stuff in ZF2 so you can migrate piecemeal. I didn't really deal with this because our interfaces were fairly simple and we took it as an opportunity to overhaul the UI.
Just my $0.02, but I hope it helps.
There is no quick and easy way to migrate because ZF2 is very different from ZF1.
Related: Step by step migration from Zend Framework 1 to 2
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.
I was looking for a fresh forum software (threaded) or bulletin board (flat/partitioned). And I'm wondering if there's an implementation based on one of the big PHP frameworks (CodeIgniter, Kohana, Yii, CakePHP, ZF, Seagull, Fusebox, Symfony, eZ, Prado, or whatever...).
Reason: A framework based implementation would be inherently more secure, because of ORM and validation and abstracted processing logic. And also would be good showcase of the framework itself.
Tutorials and example implementations of e.g. blogs are frequent for each PHP framework. But I didn't find much in the area of forums/boards. There was only a single implementation "sfSimpleForumPlugin" for Symfony, in alpha stage and seemingly abandoned, too bare-bones for practical use anyway.
However I'm surely not looking for a feature-bloated forum script. Just the common functionality, and ;) an excellent sample application for the particular PHP framework.
It's surprisingly hard to google. Is there something? Framework homepages not helpful. (And they all use phpBB or something.)
The new version 2 release of Vanilla Forums has just been recoded from scratch as an application that runs on a new PHP MVC framework called Garden. While most have probably not heard of Garden, I think the fact that it powers such a popular forum package ("382,287 sites use Vanilla Forums") stands as somewhat of a testament. If you view Vanilla's application code on GitHub, you can see that the folder structure looks similar to what you would find in other MVC frameworks. Although there doesn't seem to be an official website for the framework yet, the author has released a series of blog posts that give some insight into why the framework was developed and what features it contains.
There are many:
CupCake forum on CakePHP
Web3CMS on Yii
Also interesting for you: Comparison of Internet forum software (PHP)
I use ZF a lot and I like it very much. I've learned how to solve a big part of perfomance problems with ZF, so it's became not "enormous" and "monstrous" for me.
But I'd like to know if there are any as powerful frameworks as Zend for PHP. Maybe CodeIgniter is? What is it? What are its cool features? Anything else?
And, are there any powerful frameworks which realises not MVC? Powerful means not just implementing of design pattern but a library of useful classes, functions, etc
There is a difference between frameworks, some are regualr frameworks (used to be called 'class libraries'), and some are 'full stack frameworks' (used to be called 'frameworks'). The web is and will always be about buzz-words...
Zend is a regular framework, which means you can use it's components separatly, and you aren't forced to use them. In a full stack framework, like CakePHP (I don't reallt know code igniter), you are locked inside. You can only use it's classes and they are hard to extend.
If you are looking for a competitor for ZF, be sure not to compare it with a 'full stack' framework, because it's a different thing, and it solves different problems...
Other then that, I don't know any frameworks that do not implement or give you the possibility to implement MVC, just because it's very applicable to web applications.
I'm a big ZF fan, but you can take a look to Symfony which is pretty powerfull but maybe a little to heavy sometimes.
I'd personally recommend Kohana. They just released 3.0 less than a week ago (it's in the forums, not on the dl page). It used to be a branch of CodeIgniter for PHP5, but it just underwent a big rewrite so now it's much cleaner and faster.
Basically, it does just enough to help you, but stays the hell out of your way. It's very lightweight and fast. It beats the pants off of pretty much any other framework I've used - Zend, Symfony, CakePHP, and CodeIgniter.
The thing about Zend is that you can actually decouple its components. You can use them without using the rest of the framework (just register the autoloader). Really, Zend to me is more like a heavy framework with a bunch of PEAR libraries in it. The framework is too heavy for normal use, but the components are nice.
I personally like CodeIgniter, it is good to start from 0 due to its great documentation and it can be easily expanded with the lot of plugins. It is considered pretty fast framwework (faster than ZF, Cake php and Symphony) however its speed is lowered by PHP4 support and any framework will lose its speed as you add new libraries and plugins there.
ZendFramework is the most powerfull php framework I have found. CodeIgniter is a lightweight MVC framework so its not powerful.
ZendFramework also has loose coupling so you can use some Classes without other classes like the front controller.
CodeIgniter MVC is not as powerful and the ZendFramework MVC but i haven't tried any other framework
I've choosen CodeIgniter because it is lightwight and because i'm not using a ORM and Smarty, this means i only need the router and controller/model class.
But it is missing a few features like user/login handling being the most serious.
I also use some zend classes like amazon access.
I have to develop a CMS for a friend of mine, nothing commercial...
I'd like to take this opportunity to learn a php framework, to see if it would be suitable for future (and more complex) developments, or at least to steal some nice ideas...
SO I'd like to easily implement a content management system and at the same time have a look at a modern php framework (one of the rails inspired ones, or at least implementing MVC, which I think covers them all...)
I've heard of http://www.digitaluscms.com/, built with zend framework, and http://radiantcms.org/, but that is ruby on rails (I'd prefer php for ease of deployment and hosting...)
If you want a CMS built with a real Framework, I've heard (just today, actually) of Diem, which is built upon symfony (and uses some components of Zend Framework).
Maybe Sympal, also based on symfony, could interest you too.
If you want to learn, and work with symfony, one of those two might be the perfect match for you.
Still, as those two are not as popular as Drupal (or Joomla, or whatever other well-known CMS you can think about), I would probably not use them for any "real" site -- at least, not before studying them for a while.
For a framework, I would recommend Code Igniter wholeheartedly. It's MVC based, super-lightweight and it reminds you of Rails a lot. You can check out a screencast of a hello world application here: http://codeigniter.com/tutorials/
In regards to a CMS that could be http://expressionengine.com/, it's a popular CMS built on top of Code Igniter. I don't really like it as a CMS, but you were asking about a good platform to build on, so that would probably be a great bet.
The most common PHP frameworks are Symfony and CakePHP - I don't know CakePHP so much, but personally Symfony is too big and bloated for my taste, although very powerful.
The most common used CMSes are of course: WordPress, Joomla and Drupal. There are endless other systems available, but most of them don't really have a great platform to build on.
Good luck!
Others have mentioned various pre-built CMS applications. If you want to build your own in an existing PHP framework, check out CakePHP or symfony.
http://cakephp.org/
http://www.symfony-project.org/
But really, you should just learn Django, because it's so awesome.
A free CMS built on CodeIgniter is PyroCMS. The demo is currently down but installer is so freaking simply you could have it running in a few minutes.
Modular, multi-lang, UTF-8 throughought and pretty easy to skin.
Unlike other CMS' I have seen built on frameworks, PyroCMS doesn't touch the core framework at all, which means future upgrades of CodeIgniter will be easy.
you should take a look at silverstripe - besides the fact hat you really should read about what a framework nowadays can deliver, so some basic knowledge about Rails and Django is absolutely essential to put yourself in a position of beeing able to decide yourself what is good for you and what is not.
One most important thing ignored is RESTful-ness - many CMS or Frameworks still not support it or at least do it very complicated. Yuo need to read about REST to understand, why you want a framework or / and CMS that suppirts REST.
Talking about Joomla here is, of course, a joke.
Use Joomla. It probably won't teach you much but you will get a very nice system. Professional level even. Joomla has a MVC framework but most of what you do will be configuration. But really who wants to do a cms any more anyway? So many of them out there.
All kidding aside, Joomla is written in php, scales nicely and has a nice admin interface for the client/end user. It is also used all over the place.
If you really want to learn a usable framework try to write the cms in zend or codeigniter. those are beautiful frameworks.
If you really want to experiment a popular PHP framework while developing a simple CMS, look for a real CMF.
The only one I know at this time is Symfony2 CMF. It's a set of Symfony bundles providing popular CMS features like the Node concept, blocks, menus, dynamic routing (for routing to newly created nodes), etc.
Using a CMF instead of a CMS prevents you to configure your application only using a big administrative back-end and make you to understand the framework behaviors. As a consequence, you will be able to use the framework (Symfony in my example) even for a non CMS related project !
Using a CMS like Wordpress or Drupal (which is built on top of Symfony) will hide you the framework.
P.S: Actually, Symfony CMF is only compatible with Symfony 2. But beta versions of the bundles are already available for Symfony 3. Anyway, there is a LTS version of Symfony 2 whose bug fixes support ends in 2018 and security support in 2019 !