Zend Framework or Symfony - zend-framework

I am in the process of migrating to a new PHP Framework. I have been involved in heavy development using the CodeIgniter Framework, but I am finding it a little too lightweight for my needs now.
I have boiled my choices down to either Zend Framework or Symfony. I know the learning curve for both is relatively high. However, I just wanted to get a rough idea of which will be worth getting stuck into (as I will be spending quite a lot of time getting familiar with the chosen framework).
If it helps narrow the answer down a little. I am not looking to build a simple blog or anything like that. I am in need for something that will support full-fledged development of e-commerce systems, customer relationship managers and content management systems.

Personally i have been working with ZF since it was in version 1.6, and i am pretty happy with it , I had seen very good improvement since 1.6 , but i think ZF missing some ideas :
1- ORM and later on very great implementation between ZF + Doctrine 1.2 has taken very popularity
and i honestly depend on ZF + Doctrine in many projects
and these days we can see great integration between ZF + Doctrine2
2- the symfony's bundle is completely forgotten in ZF
Do you think Zend framework misses the Symfony's Bundle principle ?
and i think its really indeed to see it soon (hopefully in ZF 2 )
3- i had many good points about symfony 1
- doctrine built in support
- bundle principle
- admin generators which can save a lot of time
- symfony plugins is very popular
- symfony documentation is really good
finally , i had took a deep look at symfony 1 but i am really taken by the buzz of symfony2 in the late of 2010 and till today its public preview http://symfony.com/download
and i am trying to spend some time learning it .
wish me luck :)
update
I don't want my answer to imply that ZF isn't good or symfony is better than ZF , ZF IMO very powerful library and being ZF developer === advanced + powerful PHP OOP programmer .

I had to make this choice about 1.5 years ago. I first looked at ZF and read up on it as much as possible, but at the end of the day I never really felt comfortable with it. It felt over-engineered, and I found myself getting lost in the code pretty often. I then checked out Symfony with Doctrine. I was able to come to grips with the code base much quicker than ZF. I've since used Symfony on 30+ projects, everything ranging from small sites to pretty large applications and I couldn't be happier. Their admin generator tools have cut down the time I spend building CMS's by a ridiculous amount, and I'm constantly adding my own additions so that future projects take even less time. On top of that, their routing framework, forms framework, and plugin architecture are very well built and very useful. (And Doctrine is a God-send, but you can use that with ZF as well, it's just nice that Symfony uses it by default and has some tighter integration with it.)
Luckily, both ZF and Symfony are highly extensible, so whichever you choose, you'll be better off than using CodeIgniter.

Personally I would rather invest my time in learning the Zend framework. I've played with symfony in the past, and it does have its merits, but I like the Zend framework better. For me Symfony (1.x) has that "things patched together with duct tape" feel around it. There's a lot of different plugins, with varying code quality. ZF tries to raise the bar and feels like a more professional, and well thought out framework (and on top of that ZF is very flexible). Symfony might be better suited for prototyping though because of the admin generator.

I haven't looked at Zend, but I did look at a couple of other frameworks before deciding on symfony.
For me it was the quality of the documentation - which for Symfony is excellent.
The thing with frameworks is that if you cannot use features because they are not well documented then they are not features at all.
It really boils down to your own requirements and how each feels - as you know the whole point of a framework is to work with it, if you are always adding extra code or exceptions then that framework is not right for you.

Related

Play 2 Framework code generation tool or Yii/Cakephp frameworks?

I'm trying to get started with a couple of web applications. However, choosing a framework to work with can be overwhelming!
I've worked with Java in the past, and since I do C# .NET at work, I don't mind learning and extending my Java knowledge. Now, the only framework that seems to work without jsp and other applet things that I've never understood is Play 2 Framework. I downloaded this framework, put the executable file in my path, and it seems that it would work for me. However, I came across CakePHP and Yii frameworks (I'm sure there is more) and notice there is a code generation tool that gets the database and automatically generates the models for you + the CRUD and such. Geez that is a save of time.
I went and googled my question and got that this is also possible in Play Framework (bummer only found the module for 1.x framework.)
How to quickly generate models in play framework 1.2?
http://www.playframework.org/modules/db
So, my question is...
Is there a module that would easily let you do this work in Java Play 2.0 Framework as in the mentioned PHP frameworks?
If no, would it be worthy (any advantages) to stick to the Java Framework?
If no, what php framework or even python (but Ruby) framework you consider has the best tools like this auto completion feature? I don't mean learning a new language, I will have to anyways. But rather to learn a language I can do things other than web development (for Ruby I know you can do more stuff but it might be just a waste of time to learn that other language. However, learning Python, Java, would open up app and phone development as well)
Don't mean to open a debate, please be concise (not like me) in your answer. Thanks!
From personal experience, there's several difference in both frameworks, particularly the way models are handled in cake vs yii.
In cakephp you cannot use composite primary key, this is the main deal-breaker for me. Composite primary key is supported in Yii.
Cakephp enforces convention, while yii favors convention, you are not forced to follow a certain standard.
Out of the box performance, I think yii has the advantage, but as with performance tuning, with proper cache configuration, and as long as you are careful in using the ActiveRecord patterns, they are not that much apart
As a side note, I have lead web app implementation with both CakePHP and Yii, the feedback that I got from the team was that the less experienced team preferes CakePHP, while Yii is preferred by the more experienced team. Make of that what you will.
Well it can turn out to be a very long debate. Each has its own life. So far from Experience I have found Yii to be most promissing than everyone. For me it matters who gives more work in less time. Cake is a bit heavy but Yii is light weight framework. I am from .Net Background but it took mew few weeks to get going with Yii

Migrating from one PHP framework to another

I'm working with a web company that's approaching a point where it will likely need re-think the product as a V2 - due to outgrowing some of its V1 foundations and principles that have been built into virtually everything, from the data model to the user interfaces. For various reasons, this evolution might involve a migration from CakePHP (with which the V1 has been built) to Symfony or Zend.
I would like to ask for some experienced views on how people might have managed a transition like this for a website that has significant traffic and generates revenue. I don't want to open up a discussion on the pro's & con's of different PHP frameworks, or why this migration might be needed. Rather, I would be very interested in hearing whether there are some practical alternatives to essentially building a V2 from scratch alongside the V1 for a couple of months - and locking up precious coding time for the duration of this intense period. An example of such an alternative might be migrating an app in parts over a longer period of time.
I'd be grateful for any views from people who might have managed or been involved in such transitions.
Thanks in advance.
Symfony makes it very easy to break out of the framework at almost every level in the process, making it easy to integrate with other frameworks. Here's how I would do this:
Set up and install Symfony.
Put the existing CakePHP project inside of Symfony as a plugin.
Set the plugin to have a catch-all route that takes the parameters and processes it as a Cake PHP request. Now you have all your CakePHP pages working in Symfony. This is probably the trickiest step and may involve resolving some autoloading or other collision issues.
You can now selectively migrate CakePHP models, controllers, and views.
A major benefit of this approach is that it lets you maintain an agile development process. You can port little bits of the website at a time all the way through and test them as you go.
If you will be moving to Zend, you can start using Zend Classes one-by-one to help you with basic tasks. You can very well use any model class with ZF. So only think that will need that 'big bang' action will be the controllers/views. In fact you can also integrate your existing views with ZF. But I think that'S an overkill and it will not last very long...
So - wrapped up
switch to zend classes for basic tasks like RSS generation, emails, validation, etc. That will help you in the next step.
make the big bang action and switch (m)VC to ZF, leave models
switch models to something more Zend-ish

Zend Framework - Ruby on Rails has a screencast showing how to code a blog in 15 minutes. Does ZF have a similar screencast?

Ruby on Rails has a screencast presentation they use to promote their framework that shows how to code a basic weblog system in 15 minutes with RoR. Does the Zend PHP Framework have a similar screencast/presentation/whatever demonstrating something similar? It doesn't have to be a blog specifically, but I would definitely like to find a presentation that shows some rapid application development using ZF.
Where I'm coming from: I have been programming on and off for years now. I started out with QBASIC waaaaay back in the day making little programs (text adventure games, screensavers, simple little things). I then moved to C++ but never really did anything too impressive with it. Since then (probably 5 years or so now) I have started to use C# for my desktop development and PHP for my web development. I've made some pretty cool tools here and there, but am certainly not a professional programmer by any stretch of the term as it has always simply been a hobby of mine.
Right now I have two major web applications that I will start work on shortly. (Like tomorrow, or later tonight ideally.. :) ) Both will be database-driven apps that will require user registration, the ability to manipulate data that is specific to their account (their posts, listings, user account details, etc), amongst other things.
Currently I am evaluating different frameworks to help me develop these web apps more quickly. I've been looking at, and have heard good things about Ruby on Rails. Hulu and YellowPages.com using it is an obvious endorsement - Of course, I have heard about the scalability issues that it potentially has; but that shouldn't be an issue with what I am working on. I don't expect millions of users per day for either project.
I am also seriously looking at the Zend Framework for my needs because I already have some experience with PHP. Ideally I would like to find a ZF screencast that shows an app being written quickly so that I have a roughly equal comparison between the two options I am exploring and can see first-hand how things get done in both.
That said - I am not opposed to considering frameworks other than RoR or ZF. The only research I've done on the subject has been over the past couple of days so I am quite certain that there are other excellent options out there that I've not even looked at - or heard of. Of course, it'd be awesome if there is a rapid app dev presentation that I can watch for whatever else is suggested.
So - Suggestions? Links to good screencasts that show rapid application development in other frameworks? Are there other PHP frameworks that I should be considering? (Ones that are easy to deploy would be ideal, so I don't have to purchase a dedicated server that I have full control over. I'd like to keep my hosting costs down assuming that it's reasonable)
Thanks in advance!
-Sootah
You can checkout ZendCasts.com
However, when deciding between ZF and RoR, you should be aware that they are very different from each other. RoR is a full stack with integrated ORM built on AR and a rather rigid structure. It's powerful and there is lots of magic inside and I'd say it's RAD capabilities are above ZF due to rake being more powerful than Zend_Tool
ZF, on the other hand, is first and foremost a loosely coupled component library with a use-at-will architecture for maximum flexibility. You can use it's components together, but you don't have to. While it does feature convention over configuration, ZF doesn't take you by the hand too much. It expects you know how to walk. Also ZF has no full fledged ORM and no AR, but you can very much integrate Doctrine or Propel or whatever library you like to use.
You often hear folks new to ZF complain about it is hard to get into it, simply because they expect ZF to work like RoR or Symfony or Cake, e.g. a full stack framework
EDIT:
Cake aims to be a port of RoR to PHP. It is built around ActiveRecord. Like CI < v2, it is backwards compatible with PHP4, which means it doesn't fully utilize the OOP capabilities you get in PHP5. I'd say both are easier to get in than ZF though.
This is a common question on SO.
I posted some valuable links in my response to this post
If you Google for such tutorials, look for Zend Application or Zend Tool, not ZF.
The difference between the other frameworks and Zend Framework is that Zend Framework is rather a general purpose framework, not application framework (not only for MVC, HTTP). E.g. Google uses ZF to provide access to their services.
You may easily use Symfony or CodeIgnitier with Zend Framework together.
BTW, To be precise, tutorials you ask are not blogs, but just a simple CRUD controllers. You may use Wordpress to create blog in 15 minutes, (then customize it) but not a PHP Framework.

Difficulties when learning Zend Framework 1.8

I am a newbie of Zend Framework.
I downloaded the Zend Framework and then followed the official quickstart tutorial to build a very simple registration form. But after that, I find very hard to learn different elements of Zend Framework.
Many tutorials mention frontController and registerAutoload() in the bootstrap file. However, it seems that I can't see it again in the code in version 1.8 (both in the official quickstart tutorial and Getting Started with Zend Framework 1.8). Many tutorials contain the old version of code and it seems very different in v1.8.
I start with writing registration form with password confirmation. I read the official document and find the custom validator for password confirmation. It just puts the class there and doesn't mention how I can use it. I don't know where I should put this file and I can't find any hints in Google. The "class not found" error always makes me sick (I've tried addPrefixElement, set_include_path but they don't work).
User registration, email activation, login, access control are very common tasks. But I don't even find a piece of sample code in v1.8 that I can run in my machine. I am very frustrated about Zend Framework.
Does anyone give me some advices?
I have also just started learning the zend framework. I also find alot of old tutorials that make learning confusing and hard,
but there are some resources that I find help in learning the zend framework:
http://www.zendcasts.com/ - they have tutorials on ZF1.8 already, like Bootstrapping using Zend_Application, etc.
Some useful blogs that might help:
http://weierophinney.net/matthew/
http://www.thomasweidner.com/flatpress/index.php
http://smartycode.com/zf/
http://codeutopia.net/blog/
Forums to ask your questions:
http://www.nabble.com/Zend-Framework-Community-f16154.html - alot of ZF developers seem to be here to answer your questions :) much more than the official Zend Forums below ...
http://forums.zend.com/viewforum.php?f=69
As to class not found, I think you didn't autoload?
http://framework.zend.com/manual/en/zend.loader.autoloader-resource.html
Parts of Zend Framework have changed slightly in the 1.8 release but everything should be backwards compatible so all code example written using the 1.* release series should still work with little or no modification. The main areas that are different are
Zend Loader (related to register_autoload) which now has several improvements related to performance and some slight differences in its API (with a PHP warning if you use the old way). I wouldn't worry about this too much as a beginner - just follow the tutorial or continue to use include/require statements until you become annoyed with adding them all the time!
Zend Application which basically allows you to create your set-up and initialisation code with less fuss. Again, you don't have to use it and you can happily write a manual bootstrap class to get you used to how the framework is put together.
With regards to getting started I would highly recommend getting your head around the Zend Controller component, particularly the front controller part and this diagram.
For authentication look at Zend Auth, for e-mail see Zend Mail, for access control see Zend Acl and for forms and validation see Zend Form, Zend Validate and Zend Filter. The form and validation components will explain about paths and adding your own custom validators and form elements.
The other area of importance is Zend Db which allows you to persist your data to a database. There is also Zend View which represents the view layer in the MVC stack. In my opinion these are the key components of a basic ZF application. From there you can explore the other components as and when you need them.
Don't forget that the Zend Framework is specifically designed to be loosely coupled and it is very easy to use a different component from another project for a particular task. Sometimes it is necessary to write your own components too. If there is a component you would prefer to use over the Zend component then go ahead and do so.
Honestly, the documentation is very good although it is hard to navigate for beginners. Once you get your head around the core components everything will become a lot clearer.
Also try following this tutorial. It will help explain a lot of the basics.
I recommend these video tutorials pu up by a guy called Alex, he keeps them up to date and releases new ones all the time,they are all relevant to ZF 1.8 and 1.9.
He has even a detailed video tutorial covering ACL, login forms etc. (my first steps with Zend were easier thanks to him!)
http://alex-tech-adventures.com/development/zend-framework.html?start=15
- his site is a bit comfusing but worth the time in figuring it out :)
Cheers
Roman
Some tips:
Here is a nice diagram of the Dispatch process
http://nethands.de/download/zenddispatch_en.pdf
It is much easier to understand ZF if you are experienced in OOP / OOP Design Patterns
When I first stumbled across ZF I had little knowledge of OOP. ZF prompted me to learn OOP which was a very good thing.
Distinguish between the 'magic' of ZF and the actual ZF Architecture
Although I have a good understanding of ZF Classes I still get confused when ZF adds its 'magic' to the mix.
When I say 'magic' I am referring to things like
the default objects loaded and used if none specified, and
url-controllername-filepath-filename inflections / naming conventions.
config settings-to-class-instantiation mappings
ZF is a bit like a crack-dealer in the sense that the 'Getting Started Tutorials' get you hooked straight away. They perform so much magic that it makes you think
.oO(Wow - how simple was that! This framework is cool!)
Then as soon as you start to try to do your own thing - the magic starts to get really confusing.
So - my tactic is to remove as much ZF magic as possible. If you have the option to specify a class to use, or a router to use, then specify it. Don't let Zend do it for you.
Then when something weird is happening you can find the bugs more easily.
Also, if you specify the locations of classes/ paths as (opposed to letting ZF magically inflect paths and find scripts), then you do not have to worry about questions of 'where to put this? , where to put that?' - you just put things where you want them to be and explicitly point ZF to them.
As you get more familiar with ZF you might then want to let it take over and do some magic for you. Only then can you really understand why that magic is convenient.
As Tim Wardle said in another answer - favour require statements over zend loader until you really need it.
If you are a PHP design house that churns out 10 website projects a week, then ZF Magic can be really useful. If you are designing your first ZF app - then 'reducing complexity' is a more important design goal than 're-usability'.
Browse the code
It might seem obvious but one of the best ways to learn about the ZF is to look at the code.
Again the ZF magic can get in the way - I often want to look at a method's arguments to discover what i need to pass in only to discover that it expects an ambiguous 'options array' (not exactly helpful). After a while, though, you start to notice the conventions used in how an 'option key' marries up to a getter/setter method. So, keep looking at the code and familiarising yourself with the 'ZF way'.
I 'ope that 'elps.
The Front Range PHP Users Group website has some presentations on Zend Framework which may be of use.
I have so much sympathy with you Billy. I am a newbie and the confusion between the old way and the new way is almost just too much to handle. Also see here for someone who points out some of the main differences:
http://crossfunctional.wordpress.com/2009/05/
All documentation, particularly Zend's documentation is absolutely horrible. It all assumes that you "know" where to put the snippets they are referring to and how they work together. If I already knew those things, I wouldn't need the documentation. No full example applications with authentication etc. that you can download and modify. I'm seriously regretting putting any time into trying to learning this framework. All examples that I can find are apparently for older versions. I followed one for authentication on youtube that was designed for 1.8 to the letter. It fails to work in 1.9.x. Can't get it to work for the life of me. Completely frustrated with Zend Framework!
Zend Framework has shifted from being a relatively accessible and simple system to a more complex entity. It has gone through a number of rapid developments over the past couple of years which have left a lot of older documentation around.
We have projects that are stuck on Version 1.7.x because the differences between that and the latest version are too great which makes the dev and testing time too expensive.
I like Zend Framework because it has so much depth to it but it is definitely a two edged sword for beginners.
I'd certainly recommend making use of the expertise of other users and search out some simple framework examples. ZF is highly adaptable but you need to try and work from the simplest case possible for your needs.
I think Matthew Weier o'Phinney, (search for 'Phly, boy, phly') is one of the more approachable members of the dev team and has loads of examples and ideas on his website.
Good luck!

Web Development Frameworks: Zend Framework vs Ruby on Rails vs ASP.NET MVC [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I've used Zend Framework before but would like to know how you think it compares to other MVC frameworks? Which is better and why?
Zend Framework my background with this is ~3 mths
Good:
Templating thru Zend_Layouts & Zend_Views
Zend_Forms, Zend_Validation, Zend_Filter: assists in form inputs
Zend_Tool now allows for something like Ruby on Rails's CMD code genration except that its now still very limited in terms of functionality
Bad:
steep learning curve
can be confusing for me now still
Ruby on Rails viewed some screencasts only
Good
i like the cmd code generation for controller, actions, models and forms
it seems to be easily incorporated with AJAX
Bad
i get the impression that it will be hard to deploy
ASP.NET MVC also watched a few screencasts only
Good
i like LINQ
extensive support with VS 2010 will speed up development
Bad
expensive
Zend Framework:
Good:
Stable API, acceptable performance, doesn't get in the way when it's not needed, easy to integrate legacy databases
Bad:
Hard to get into, sometimes confusing syntax
And also the general php advantages apply, such as easy deployment, portability, large ecosystem
Rails
Good:
Easy to create a working app, easy deployment with phusion passenger, nice unit testing integration
Bad:
Performance not always great, API is always changing, hard to break out of the framework
General
Rails is helpful to create an application very quick. It definately takes longer with the Zend Framework. But only as long as no problems arise. I feel that it's way harder to detect the root of a problem in rails. All the magic happening everywhere in rails is very nice in many cases but it makes the behaviour of the whole application less predictable. So if you don't want to follow the extact path, the framework creators have thought out for you, you'll likely run into serious problems with rails. You probably have to write a third less code with rails, but that costs you a third of your control over your application.
But the biggest annoyance for me was that rails changes very much between versions. I've spent a lot of time porting applications to newer rails versions, with deprecations and api changes here and functionality externalized to plugins there. It seems that rails isn't that mature as it's said to be.
I personally love Ruby - it's a great language to code in. I also write C#.NET for my proper job and think the MVC framework is the best thing to happen to .NET since it launched. However, for maximum portability I still use PHP for my own web projects as it's really easy to find cheap hosting on Linux (and it works on IIS too).
I would add to the list CakePHP. It's really a "Rails on PHP", with strict convention over configuration and strict MVC. I personally prefer CakePHP to Zend. Oh, and deployment is really really easy.
I develop mostly in php and ruby and I think there are pros and cons of both.
I think most of us agree, Zend takes a little longer to spin up a new app. The lack of command line tools and scaffolding make the process a little less expedited. But I feel the performance is better, a lot better actually.
Ruby/Rails spins up super fast and thanks to scaffolding, you can get a working skeleton extremely quick. Performance could be better though and I think Zend dominates Rails in this category. The language is fun as hell but as others have mentioned, there is way to much magic. If you find magic methods annoying in php, your going to hate the concept of ruby, where various code blocks or gems reopen base classes and create magic that has you scratching your head and thinking, "where the hell did this come from?". Also, as others have mentioned, unless you never update your application, be prepared for migrations. Rails 3.2 all the way to the latest version, 5.0.2, I think, will have you refactoring code for a while.
If I'm developing an app that I plan to work with long term, I usually go with Zend. If I need to spin it up fast and performace/load isn't much of a major factor, I go with rails.
I don't know if I've added any more insight then the other posters but these are my personal preference.